hdoc_to_pdf.ant 2.12 KB
Newer Older
1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
<project name="hdoc_to_pdf" basedir="." default="convert">
3 4 5 6 7 8 9 10

	<!--<taskdef resource="net/sf/antcontrib/antcontrib.properties">
		<classpath>
			<pathelement location="lib/ant-contrib.jar" />
		</classpath>
	</taskdef>-->
	
	<!-- Arguments properties -->
11 12
	<property name="InputPath" 	    location="input" />
	<property name="OutputPath" 	location="output" />
13
    <property name="tmp"            location="${basedir}/tmp"/>
14
	<property name="OutputPdfPath" 	location="${OutputPath}/result.pdf" />
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
	
    <target name="convert">
			
		<echo message="The value of property of InputPath is ${InputPath}" />
        <echo message="The value of property of OutputPath is ${OutputPath}" />
        <echo message="The value of property of tmp is ${tmp}" />        

        <!-- Creation of temp dir -->
        <delete dir="${tmp}" failonerror="false"/>
        <sleep seconds="1"/>
        <mkdir dir="${tmp}"/>

		<!-- Get input hdoc file path -->
		<fileset id="fileset_hdoc" dir="${InputPath}" casesensitive="yes">
			<include name="*.hdoc"/>
		</fileset>
		<pathconvert property="HdocFile" pathsep="" refid="fileset_hdoc" />
		
		<echo message="Executing conversion..." />
	
		<!-- Unzips the hdoc to be converted-->
		<unzip dest="${tmp}" src ="${HdocFile}"/>
		
		<!-- Gives all rights to avoid bugs-->
		<chmod dir="${tmp}" perm="777"/>
		
41 42 43 44 45
        <!--launches the XSLT find_content to retrieve the content path-->
        <xslt in="${tmp}/META-INF/container.xml" out="prepare_hdoc.ant" style="xsl/find_content.xsl">
            <param name="TempRepository" expression="${tmp}"/>
        </xslt>
        <chmod file="prepare_hdoc.ant" perm="777"/>
46

47 48 49 50 51
        <!--launches the ANT prepare_hdoc.ant resulting from the previous XSLT in order to get a clean xhtml ready for the pdf conversion -->
		<ant antfile="prepare_hdoc.ant"/>		

        <!--launches the ANT xxx to execute the FS/Java script and get a converted PDF file in the output directory-->
        <!--TODO-->
52 53

		<!--temporary files and folders are deleted-->
54 55
		<!--<delete dir="${tmp}"/>-->
		<!--<delete file="prepare_hdoc.ant"/>-->
56 57 58 59 60 61
			


	</target>

</project>