Commit bc865e91 authored by bperraud's avatar bperraud

Update hdoc_to_pdf.ant which now includes basic FS PDF generator

parent b708820a
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project name="hdoc_to_pdf" basedir="." default="convert">
<!--<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="lib/ant-contrib.jar" />
</classpath>
</taskdef>-->
<!-- Arguments properties -->
<property name="InputPath" location="input" />
<property name="OutputPath" location="output" />
<property name="tmp" location="${basedir}/tmp"/>
<property name="OutputPdfPath" location="${OutputPath}/result.pdf" />
<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}" />
<project name="hdoc_to_pdf" basedir="." default="main">
<!-- OS properties -->
<condition property="isMac">
<os family="mac"/>
</condition>
<condition property="isWindows">
<os family="windows"/>
</condition>
<condition property="isUnix">
<os family="unix"/>
</condition>
<!-- Arguments properties -->
<property name="InputPath" location="input"/>
<property name="OutputPath" location="output"/>
<property name="tmp" location="${basedir}/tmp"/>
<property name="OutputPdfPath" location="${OutputPath}/result.pdf"/>
<target name="main" depends="convertMac, convertWindows, convertUnix"/>
<!-- Mac target -->
<target name="convertMac" if="isMac">
<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"/>
<!-- 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"/>
<!--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}"/>
......@@ -45,17 +52,117 @@
<chmod file="prepare_hdoc.ant" perm="777"/>
<!--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"/>
<ant antfile="prepare_hdoc.ant"/>
<!--launches the FS/Java script and get a converted PDF file in the output directory-->
<exec executable="java">
<arg value="-cp"/>
<arg value="lib/core-renderer.jar:lib/iText-2.0.8.jar"/>
<arg value="org.xhtmlrenderer.simple.PDFRenderer"/>
<arg value="${tmp}/flat_hdoc.xhtml"/>
<arg value="${OutputPath}/result.pdf"/>
</exec>
<!--temporary files and folders are deleted-->
<delete dir="${tmp}"/>
<delete file="prepare_hdoc.ant"/>
</target>
<!-- Windows target -->
<target name="convertWindows" if="isWindows">
<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..."/>
<!--launches the ANT xxx to execute the FS/Java script and get a converted PDF file in the output directory-->
<!--TODO-->
<!-- Unzips the hdoc to be converted-->
<unzip dest="${tmp}" src="${HdocFile}"/>
<!-- Gives all rights to avoid bugs-->
<chmod dir="${tmp}" perm="777"/>
<!--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"/>
<!--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 FS/Java script and get a converted PDF file in the output directory-->
<exec executable="java">
<arg value="-cp"/>
<arg value="lib/core-renderer.jar;lib/iText-2.0.8.jar"/>
<arg value="org.xhtmlrenderer.simple.PDFRenderer"/>
<arg value="${tmp}/flat_hdoc.xhtml"/>
<arg value="${OutputPath}/result.pdf"/>
</exec>
<!--temporary files and folders are deleted-->
<delete dir="${tmp}"/>
<delete file="prepare_hdoc.ant"/>
</target>
<!-- Linux target -->
<target name="convertUnix" if="isUnix">
<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"/>
<!--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"/>
<!--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"/>
<!--temporary files and folders are deleted-->
<!--<delete dir="${tmp}"/>-->
<!--<delete file="prepare_hdoc.ant"/>-->
<!--launches the FS/Java script and get a converted PDF file in the output directory-->
<exec executable="java">
<arg value="-cp"/>
<arg value="lib/core-renderer.jar:lib/iText-2.0.8.jar"/>
<arg value="org.xhtmlrenderer.simple.PDFRenderer"/>
<arg value="${tmp}/flat_hdoc.xhtml"/>
<arg value="${OutputPath}/result.pdf"/>
</exec>
<!--temporary files and folders are deleted-->
<delete dir="${tmp}"/>
<delete file="prepare_hdoc.ant"/>
</target>
</target>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:h="urn:utc.fr:ics:hdoc:container"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
name="hdoc_to_pdf"
default="main">
<target name="main">
<xslt in="/home/raphael/Documents/Travail/NF29/projet/hdoc/hdoc_to_pdf/tmp/content.xml"
out="/home/raphael/Documents/Travail/NF29/projet/hdoc/hdoc_to_pdf/tmp/hdoc_nsless.xhtml"
style="xsl/ns_remover.xsl"/>
<xslt in="/home/raphael/Documents/Travail/NF29/projet/hdoc/hdoc_to_pdf/tmp/hdoc_nsless.xhtml"
out="/home/raphael/Documents/Travail/NF29/projet/hdoc/hdoc_to_pdf/tmp/flat_hdoc.xhtml"
style="xsl/hdoc_flattenizer.xsl"/>
</target>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xpath-default-namespace="http://www.w3.org/1999/xhtml">
<xsl:output method="text" indent="yes"/>
<xsl:template match="html">
Hello world !
<xsl:output method="xml" indent="yes"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment