diff options
author | Kelly Campbell <kellyc@apache.org> | 2001-02-06 07:34:48 +0000 |
---|---|---|
committer | Kelly Campbell <kellyc@apache.org> | 2001-02-06 07:34:48 +0000 |
commit | 4e96b8b7a7647e183a5a916a1c42deddbd91c6af (patch) | |
tree | 0cdbe16d0b2ebe56d997d912d8672a7cbf2477b6 | |
parent | 1a3636171f599e31d9964fbcf6e32cfc3e6fbbf3 (diff) | |
download | xmlgraphics-fop-4e96b8b7a7647e183a5a916a1c42deddbd91c6af.tar.gz xmlgraphics-fop-4e96b8b7a7647e183a5a916a1c42deddbd91c6af.zip |
Added support for PDF outlines (aka bookmarks). See the example in
docs/examples/fo/pdfoutline.fo for an example.
PR:
Obtained from:
Submitted by:
Reviewed by:
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194025 13f79535-47bb-0310-9956-ffa450edef68
22 files changed, 2451 insertions, 79 deletions
@@ -168,6 +168,8 @@ Sometimes ant gives out this warnings, but the build is finished without any pro <property name="src.properties.xsl" value="${src.codegen}/properties.xsl"/> <property name="foproperties.xml" value="${build.codegen}/foproperties.xml"/> <property name="svgproperties.xml" value="${build.codegen}/svgproperties.xml"/> + <property name="extproperties.xml" value="${build.codegen}/extproperties.xml"/> + <property name="properties.xsl" value="${build.codegen}/properties.xsl"/> <property name="propmap.xsl" value="${build.codegen}/propmap.xsl"/> <property name="enumgen.xsl" value="${build.codegen}/enumgen.xsl"/> @@ -337,24 +339,40 @@ Sometimes ant gives out this warnings, but the build is finished without any pro <!-- generate the java files from xml resources --> <echo message="Generating the java files from xml resources"/> + <xslt infile="${foproperties.xml}" xsltfile="${properties.xsl}" dependent="${propinc.xsl}" outfile="${build.src}/${replacestring}/fo/properties/fo_${ignore_this}" smart="yes"/> - <xslt infile="${svgproperties.xml}" xsltfile="${properties.xsl}" - dependent="${propinc.xsl}" - outfile="${build.src}/${replacestring}/fo/properties/svg_${ignore_this}" smart="yes"/> <xslt infile="${foproperties.xml}" xsltfile="${propmap.xsl}" dependent="${propinc.xsl}" outfile="${build.src}/${replacestring}/fo/properties/FOPropertyMapping.java" smart="yes"/> - <xslt infile="${svgproperties.xml}" xsltfile="${propmap.xsl}" - dependent="${propinc.xsl}" - outfile="${build.src}/${replacestring}/fo/properties/SVGPropertyMapping.java" smart="yes"/> <xslt infile="${foproperties.xml}" xsltfile="${enumgen.xsl}" dependent="${propinc.xsl}" outfile="${build.src}/${replacestring}/fo/properties/foenums_${ignore_this}" smart="yes"/> + + + <xslt infile="${svgproperties.xml}" xsltfile="${properties.xsl}" + dependent="${propinc.xsl}" + outfile="${build.src}/${replacestring}/fo/properties/svg_${ignore_this}" smart="yes"/> + <xslt infile="${svgproperties.xml}" xsltfile="${propmap.xsl}" + dependent="${propinc.xsl}" + outfile="${build.src}/${replacestring}/fo/properties/SVGPropertyMapping.java" smart="yes"/> <xslt infile="${svgproperties.xml}" xsltfile="${enumgen.xsl}" dependent="${propinc.xsl}" outfile="${build.src}/${replacestring}/fo/properties/svgenums_${ignore_this}" smart="yes"/> + + <xslt infile="${extproperties.xml}" xsltfile="${properties.xsl}" + dependent="${propinc.xsl}" + outfile="${build.src}/${replacestring}/fo/properties/ext_${ignore_this}" smart="yes"/> + <xslt infile="${extproperties.xml}" xsltfile="${propmap.xsl}" + dependent="${propinc.xsl}" + outfile="${build.src}/${replacestring}/fo/properties/ExtensionPropertyMapping.java" smart="yes"/> + <xslt infile="${extproperties.xml}" xsltfile="${enumgen.xsl}" + dependent="${propinc.xsl}" + outfile="${build.src}/${replacestring}/fo/properties/extenums_${ignore_this}" smart="yes"/> + + + <xslt infile="${charlist.xml}" xsltfile="${charlist.xsl}" outfile="${build.src}/${replacestring}/render/pdf/CodePointMapping.java" smart="yes"/> <xslt infile="${Courier.xml}" xsltfile="${fontfile.xsl}" mergefile="${charlist.xml}" diff --git a/docs/examples/build.xml b/docs/examples/build.xml index 016227214..d7fc67fcd 100644 --- a/docs/examples/build.xml +++ b/docs/examples/build.xml @@ -58,6 +58,7 @@ <fop fofile="${foDir}/simple.fo" pdffile="${testDir}/simple.pdf"/> <fop fofile="${foDir}/hyphen.fo" pdffile="${testDir}/hyphen.pdf"/> <fop fofile="${foDir}/character.fo" pdffile="${testDir}/character.pdf"/> + <fop fofile="${foDir}/pdfoutline.fo" pdffile="${testDir}/pdfoutline.pdf"/> </target> diff --git a/docs/examples/fo/pdfoutline.fo b/docs/examples/fo/pdfoutline.fo new file mode 100644 index 000000000..c77ae9465 --- /dev/null +++ b/docs/examples/fo/pdfoutline.fo @@ -0,0 +1,1411 @@ +<?xml version="1.0" encoding="utf-8"?> + +<!-- +THIS IS NOT THE LATEST VERSION OF THE FOP DOCUMENTATION BUT ONLY AN EXAMPLE FILE + +This files shows next to the trivial usage of fo:block and fo:inline examples of +- fo:basic-link external-destination +- fo:basic-link internal-destination +- fo:table +- fo:list-block (including a bullet from the font Symbol as list-item-label) +- fo:page-number-citation (computes dynamically the page number in section 'content') +--> + +<!-- note the extensions namespace (fox) --> + +<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" + xmlns:fox="http://xml.apache.org/fop/extensions"> + <fo:layout-master-set> + + <!-- layout for the first page --> + <fo:simple-page-master master-name="first" + page-height="29.7cm" + page-width="21cm" + margin-top="1cm" + margin-bottom="2cm" + margin-left="2.5cm" + margin-right="2.5cm"> + <fo:region-body margin-top="3cm"/> + <fo:region-before extent="3cm"/> + <fo:region-after extent="1.5cm"/> + </fo:simple-page-master> + + <!-- layout for the other pages --> + <fo:simple-page-master master-name="rest" + page-height="29.7cm" + page-width="21cm" + margin-top="1cm" + margin-bottom="2cm" + margin-left="2.5cm" + margin-right="2.5cm"> + <fo:region-body margin-top="2.5cm"/> + <fo:region-before extent="2.5cm"/> + <fo:region-after extent="1.5cm"/> + </fo:simple-page-master> + +<fo:page-sequence-master master-name="basicPSM" > + <fo:repeatable-page-master-alternatives> + <fo:conditional-page-master-reference master-name="first" + page-position="first" /> + <fo:conditional-page-master-reference master-name="rest" + page-position="rest" /> + <!-- recommended fallback procedure --> + <fo:conditional-page-master-reference master-name="rest" /> + </fo:repeatable-page-master-alternatives> +</fo:page-sequence-master> + + </fo:layout-master-set> + <!-- end: defines page layout --> + + +<!-- beginning of the PDF outline extensions --> + + <fox:outline internal-destination="sec1"> + <fox:label>What is FOP?</fox:label> + </fox:outline> + + <fox:outline internal-destination="sec2"> + <fox:label>Downloading FOP</fox:label> + </fox:outline> + + <fox:outline internal-destination="sec3"> + <fox:label>Running FOP</fox:label> + + <fox:outline internal-destination="sec3-1"> + <fox:label>Prerequisites</fox:label> + + <fox:outline internal-destination="sec3-1-1"> + <fox:label>Java 1.1</fox:label> + </fox:outline> + + <fox:outline internal-destination="sec3-1-2"> + <fox:label>XML Parser</fox:label> + </fox:outline> + + <fox:outline internal-destination="sec3-1-3"> + <fox:label>XSLT Processor</fox:label> + </fox:outline> + + </fox:outline> + + <fox:outline internal-destination="sec3-2"> + <fox:label>Starting FOP</fox:label> + </fox:outline> + + </fox:outline> + + <fox:outline internal-destination="sec4"> + <fox:label>Embedding FOP</fox:label> + </fox:outline> + + <fox:outline internal-destination="sec5"> + <fox:label>What's Implemented?</fox:label> + </fox:outline> + <fox:outline internal-destination="sec6"> + <fox:label>Limitations</fox:label> + </fox:outline> + <fox:outline internal-destination="sec7"> + <fox:label>Bugs</fox:label> + </fox:outline> + <fox:outline internal-destination="sec8"> + <fox:label>Compiling FOP</fox:label> + </fox:outline> + <fox:outline internal-destination="sec9"> + <fox:label>Getting Involved</fox:label> + </fox:outline> + <fox:outline internal-destination="sec10"> + <fox:label>FOP Relevant Specifications</fox:label> + </fox:outline> + <fox:outline internal-destination="sec11"> + <fox:label>License</fox:label> + </fox:outline> + + + + <!-- actual layout --> + <fo:page-sequence master-name="basicPSM"> + + +<fo:static-content flow-name="xsl-region-before"> +<fo:block text-align="end" font-size="10pt" font-family="serif" line-height="14pt" color="red" > +This is not the latest Fop documentation, but just an fo example. FOP - p. <fo:page-number/> +</fo:block> +</fo:static-content> + + +<fo:flow flow-name="xsl-region-body"> + +<fo:block id="secA" font-size="18pt" font-family="sans-serif" line-height="24pt" space-after.optimum="15pt" background-color="blue" color="white" text-align="center" padding-top="3pt">FOP: An Open-Source XSL Formatter and Renderer</fo:block> + + + +<fo:block id="sec1" font-size="18pt" font-family="serif" line-height="20pt" space-before.optimum="20pt" space-after.optimum="14pt" >A) + What is FOP?</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">FOP is the world's first print formatter driven by XSL formatting + objects. It is a Java 1.1 application that reads a formatting object + tree and then turns it into a PDF document. The formatting object + tree, can be in the form of an XML document (output by an XSLT engine + like XT or Xalan) or can be passed in memory as a DOM Document or (in + the case of XT) SAX events. + + </fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">FOP is part of Apache's XML project. The homepage of FOP is + <fo:inline font-style="italic" font-family="serif"><fo:basic-link color="blue" external-destination="http://xml.apache.org/fop">http://xml.apache.org/fop</fo:basic-link></fo:inline> + </fo:block> + + + + + <fo:block id="sec2" font-size="18pt" font-family="serif" line-height="20pt" space-before.optimum="20pt" space-after.optimum="14pt" >B) + Downloading FOP</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">The latest release version is <fo:inline font-style="italic" font-family="serif">FOP +0.14</fo:inline> <fo:inline font-family="serif"> + () + </fo:inline>. </fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">NOTE: you do not have to unjar or unzip this jar file.</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">Documentation can be downloaded here as <fo:inline font-style="italic" font-family="serif">HMTL file</fo:inline> +<fo:inline font-family="serif"> + () + </fo:inline> or + as <fo:inline font-style="italic" font-family="serif">PDF file</fo:inline> +<fo:inline font-family="serif"> + () + </fo:inline>.</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">To run FOP from the command line, see Running FOP. If you are interested in + embedding FOP in a Java application of your own, see Embedding FOP. + </fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">You can also download the <fo:inline font-style="italic" font-family="serif">source code v. 0.14</fo:inline> +<fo:inline font-family="serif"> + () + </fo:inline> as jar file</fo:block> + + + + <fo:block id="sec3" font-size="18pt" font-family="serif" line-height="20pt" space-before.optimum="20pt" space-after.optimum="14pt" >C) + Running FOP</fo:block> + + <fo:block id="sec3-1" font-size="16pt" font-family="serif" line-height="18pt" space-before.optimum="8pt" space-after.optimum="8pt" >1) Prerequisites</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">Following software must be installed:</fo:block> + <fo:block id="sec3-1-1" space-after.optimum="3pt" font-family="serif">a) Java 1.1.x or later</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">For the fo-file viewer mode of FOP (see below) you must have the swing classes installed. + From Java 1.2 on (aka Java 2) they are part of the standard java distribution. + If you use Java 1.1.x you must seperately include the swing classes, which can + be found at the <fo:inline font-style="italic" font-family="serif"> + Sun website</fo:inline> +<fo:inline font-family="serif"> + (http://java.sun.com/products/jfc/#download-swing) + </fo:inline>. + </fo:block> + <fo:block id="sec3-1-2" space-after.optimum="3pt" font-family="serif">b) An XML parser which supports SAX and DOM like + <fo:inline font-style="italic" font-family="serif">Xerces-J</fo:inline> +<fo:inline font-family="serif"> + (http://xml.apache.org/xerces-j/index.html) + </fo:inline>.</fo:block> + <fo:block id="sec3-1-3" space-after.optimum="3pt" font-family="serif">c) If you have to produce the flow objects files, which are the input for FOP, + you need a transformation utility to create this files from your xml files. + Normally this is an XSLT stylesheet processor like + <fo:inline font-style="italic" font-family="serif">XT</fo:inline> +<fo:inline font-family="serif"> + (http://www.jclark.com/xml/xt.html) + </fo:inline> + or <fo:inline font-style="italic" font-family="serif">XALAN</fo:inline> +<fo:inline font-family="serif"> + (http://xml.apache.org/xalan/index.html) + </fo:inline>. + </fo:block> + + + <fo:block id="sec3-2" font-size="16pt" font-family="serif" line-height="18pt" space-before.optimum="8pt" space-after.optimum="8pt" >2) Starting FOP as an standalone application</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">There are three ways to run FOP from the command line.</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">a) Batch processing formatting objects (fo) files: </fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt">java org.apache.fop.apps.CommandLine fo-file pdf-file</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">b) Batch processing xml files (includes production of the fo-files):</fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt">java org.apache.fop.apps.CommandLine xml-file xsl-file pdf-file</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">c) Previewing the fo-file:</fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt">java org.apache.fop.apps.AWTCommandLine fo-file</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">Each method uses next to the fop classes other packages. The following describes + each method in detail.</fo:block> + + <fo:block font-size="14pt" font-family="serif" line-height="16pt" space-before.optimum="8pt" space-after.optimum="4pt" >a) Method One</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">One is to first use an XSLT engine to produce the formatting object tree as an + XML document and then running the class org.apache.fop.apps.CommandLine with the + formatting object file name and PDF filename as arguments. You will need to include + FOP and your XML Parser in your classpath and so you might invoke + </fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt">java -cp fop_x_xx_x.jar;xerces.jar</fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt">org.apache.fop.apps.CommandLine fo-file pdf-file</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">If your SAX Parser is other than Xerces, you will need to set the property + org.xml.sax.parser to the SAX Parser class to use. The following example shows + the command line, if you use XP, the XML parser from James Clark: + </fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt">java -Dorg.xml.sax.parser=com.jclark.xml.sax.Driver</fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt">-cp fop_x_xx_x.jar;sax.jar;xt.jar;xp.jar;xerces.jar</fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt">org.apache.fop.apps.AWTCommandLine formatting-tree-file pdf-file</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">(You have to include xerces.jar or another xml parser which supports DOM in your classpath.) </fo:block> + + + <fo:block font-size="14pt" font-family="serif" line-height="16pt" space-before.optimum="8pt" space-after.optimum="4pt" >b) Method Two</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">Rather than performing transformation with an XSLT before invoking FOP, it is + possible, if you use XT as your XSLT engine, to just call FOP and have it call + XT for you. To do this, run the class org.apache.fop.apps.CommandLine with the + source XML file name, XSL file name and PDF file name as arguments. You will + need to include FOP, SAX, your SAX Parser and XT in your classpath and so you might + invoke + </fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt">java -Dorg.xml.sax.parser=com.jclark.xml.sax.Driver</fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt">-cp fop_x_xx_x.jar;xt.jar;xerces.jar</fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt">org.apache.fop.apps.CommandLine xml-file xsl-file pdf-file</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">Again, if your SAX Parser is other than Xerces, you will need to set the property + org.xml.sax.parser to the SAX Parser class to use. + </fo:block> + + + <fo:block font-size="14pt" font-family="serif" line-height="16pt" space-before.optimum="8pt" space-after.optimum="4pt" >c) Method Three</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">If you already produced the FO file, you can preview the results of your + transformation without using any pdf viewer by invoking FOP with the viewer + application. You will need to include FOP and your XML Parser in your classpath + </fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt">java -cp fop_x_xx_x.jar;xerces.jar</fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt">org.apache.fop.apps.AWTCommandLine fo-file </fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">The viewer uses the swing classes.</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">Note: If you are using java 2 or later (i.e. jdk 1.2. or later) you can put all + needed jar files into the subdirectory jdk1.2.x\jre\lib\ext (windows example). Then + FOP can be started without classpath: + </fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt">java org.apache.fop.apps.CommandLine fo-file pdf-file</fo:block> + + + + <fo:block font-size="16pt" font-family="serif" line-height="18pt" space-before.optimum="8pt" space-after.optimum="8pt" >3) Running FOP on MacOS</fo:block> + + <fo:block space-after.optimum="3pt" font-family="serif">Ensure that you have a recent MRJ, and that you have downloaded and + unpacked the XP and SAX distributions. The xp.jar and sax.jar files work + as is on MacOS. + </fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">Drag the FOP jarfile onto the JBindery icon. When the first dialog + appears, type "org.apache.fop.apps.CommandLine" in the "Class name" field. + Using UNIX syntax, type the names of the input formatting-object file and + the output PDF in the "Optional parameters" field. + </fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">Click on the Classpath icon. To add the xp.jar and sax.jar files, click + the "Add .zip file" button, navigate to the file in question, and click + Open. + </fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">Once both are added (the FOP jarfile will already be in the list), click + Run. A "stdout" window will appear and display FOP runtime messages. + </fo:block> + + + <fo:block font-size="16pt" font-family="serif" line-height="18pt" space-before.optimum="8pt" space-after.optimum="8pt" >4) Problems</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">If you have problems running FOP, please have a look at the + <fo:inline font-style="italic" font-family="serif">FOP FAQ</fo:inline> +<fo:inline font-family="serif"> + (faq.html) + </fo:inline>. If you don't find a solution there, + you can ask for help on the list fop-dev@xml.apache.org. Maybe it's bug and + maybe somebody is already working on it. + </fo:block> + + + + + <fo:block id="sec4" font-size="18pt" font-family="serif" line-height="20pt" space-before.optimum="20pt" space-after.optimum="14pt" >D) + Embedding FOP </fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">Instantiate org.apache.fop.apps.Driver. Once this class is + instantiated, methods are called to set the + Renderer to use, the (possibly multiple) ElementMapping(s) to + use and the PrintWriter to use to output the results of the + rendering (where applicable). In the case of the Renderer and + ElementMapping(s), the Driver may be supplied either with the + object itself, or the name of the class, in which case Driver will + instantiate the class itself. The advantage of the latter is it + enables runtime determination of Renderer and ElementMapping(s). + </fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">Once the Driver is set up, the buildFOTree method + is called. Depending on whether DOM or SAX is being used, the + invocation of the method is either buildFOTree(Document) or + buildFOTree(Parser, InputSource) respectively. + </fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">A third possibility may be used to build the FO Tree, namely + calling getDocumentHandler() and firing the SAX events yourself. + </fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">Once the FO Tree is built, the format() and render() methods may be + called in that order. + </fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">Here is an example use of Driver from CommandLine.java:</fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt">Driver driver = new Driver();</fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt">driver.setRenderer("org.apache.fop.render.pdf.PDFRenderer", version);</fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt">driver.addElementMapping("org.apache.fop.fo.StandardElementMapping");</fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt">driver.addElementMapping("org.apache.fop.svg.SVGElementMapping");</fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt">driver.setWriter(new PrintWriter(new FileWriter(args[1])));</fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt">driver.buildFOTree(parser, fileInputSource(args[0]));</fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt">driver.format();</fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt">driver.render();</fo:block> + + + + + + + <fo:block id="sec5" font-size="18pt" font-family="serif" line-height="20pt" space-before.optimum="20pt" space-after.optimum="14pt" >E) + What's Implemented?</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">Also see STATUS for what is being worked on.</fo:block> + + <fo:block font-size="16pt" font-family="serif" line-height="18pt" space-before.optimum="8pt" space-after.optimum="8pt" >1) Formatting Objects</fo:block> + <fo:list-block start-indent="1cm" provisional-distance-between-starts="12pt" font-family="serif"> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>root </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>layout-master-set </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>simple-page-master </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>region-body </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>region-before </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>region-after </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>page-sequence </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>sequence-specification </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>sequence-specifier-single </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>sequence-specifier-repeating </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>sequence-specifier-alternating </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>flow </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>static-content </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>block </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>list-block </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>list-item </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>list-item-label </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>list-item-body </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>page-number </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>display-sequence </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>inline </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>display-rule </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>display-graphic </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>table (minimal support)</fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>table-column (minimal support)</fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>table-body (minimal support)</fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>table-row (minimal support)</fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>table-cell (minimal support)</fo:block> +</fo:list-item-body> +</fo:list-item> + </fo:list-block> + + + + <fo:block font-size="16pt" font-family="serif" line-height="18pt" space-before.optimum="8pt" space-after.optimum="8pt" >2) Properties</fo:block> + <fo:list-block start-indent="1cm" provisional-distance-between-starts="12pt" font-family="serif"> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>end-indent </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>page-master-name </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>page-master-first </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>page-master-repeating </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>page-master-odd </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>page-master-even </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>margin-top (only on pages and regions)</fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>margin-bottom (only on pages and regions)</fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>margin-left (only on pages and regions)</fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>margin-right (only on pages and regions)</fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>extent </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>page-width </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>page-height </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>flow-name </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>font-family </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>font-style </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>font-weight </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>font-size </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>line-height </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>text-align </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>text-align-last </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>space-before.optimum </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>space-after.optimum </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>start-indent </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>end-indent </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>provisional-distance-between-starts </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>provisional-label-separation </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>rule-thickness </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>color </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>wrap-option </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>white-space-treatment </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>break-before </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>break-after </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>text-indent </fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>href</fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>column-width</fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>background-color</fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>padding-top (only in conjunction with background color)</fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>padding-left (only in conjunction with background color)</fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>padding-bottom (only in conjunction with background color)</fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block>padding-right (only in conjunction with background color)</fo:block> +</fo:list-item-body> +</fo:list-item> + </fo:list-block> + + + + + + + <fo:block id="sec6" font-size="18pt" font-family="serif" line-height="20pt" space-before.optimum="20pt" space-after.optimum="14pt" >F) + Limitations</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">Although FOP implements the above listed fo objects and properties, sometimes it does so + only in a limited way. + </fo:block> + + <fo:block font-size="16pt" font-family="serif" line-height="18pt" space-before.optimum="8pt" space-after.optimum="8pt" >list-block</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">The fo working draft allows describes two ways to markup lists.The list-block must have as + children either: 1) pairs of fo:list-item-label and fo:list-item-body formatting objects, or + 2) fo:list-item formatting objects.</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">At the moment FOP only implements the second way. Therefore a list has a basic structure like this:</fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"><fo:list-block></fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"><fo:list-item></fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"><fo:list-item-label><fo:block></fo:block></fo:list-item-label></fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"><fo:list-item-body><fo:block></fo:block></fo:list-item-body></fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"></fo:list-item></fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"></fo:list-block></fo:block> + + + <fo:block font-size="16pt" font-family="serif" line-height="18pt" space-before.optimum="8pt" space-after.optimum="8pt" >Padding</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">Padding works in conjunction with indents and spaces. It is only implemented + for blocks. At the moment padding can't be used to make extra space (indents+spaces + must be used), but only to control how much the background-color extends beyond + the content rectangle. + </fo:block> + + + <fo:block font-size="16pt" font-family="serif" line-height="18pt" space-before.optimum="8pt" space-after.optimum="8pt" >Tables</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">There two limitations for tables: 1) FOP needs you to explicitly specify column widths + 2) Cells have to contain block-level FOs. They can't contain straight character data. + </fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">A working basic example of a table looks like this: </fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"><fo:table></fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"> <fo:table-column column-width="150pt"/></fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"> <fo:table-column column-width="150pt"/></fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"> <fo:table-body font-size="10pt" font-family="sans-serif"></fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"> <fo:table-row></fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"> <fo:table-cell></fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"> <fo:block>text</fo:block></fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"> </fo:table-cell></fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"> <fo:table-cell></fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"> <fo:block>text</fo:block></fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"> </fo:table-cell></fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"> </fo:table-row></fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"> <fo:table-row></fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"> <fo:table-cell></fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"> <fo:block>text</fo:block></fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"> </fo:table-cell></fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"> <fo:table-cell></fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"> <fo:block>text</fo:block></fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"> </fo:table-cell></fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"> </fo:table-row></fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"> <fo:table-row></fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"> <fo:table-cell></fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"> <fo:block>text</fo:block></fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"> </fo:table-cell></fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"> <fo:table-cell></fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"> <fo:block>text</fo:block></fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"> </fo:table-cell></fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"> </fo:table-row></fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"> </fo:table-body></fo:block> + <fo:block font-size="10pt" font-family="monospace" line-height="12pt" space-before.optimum="0pt" space-after.optimum="0pt"></fo:table></fo:block> + + + + + + + + + + + + <fo:block id="sec7" font-size="18pt" font-family="serif" line-height="20pt" space-before.optimum="20pt" space-after.optimum="14pt" >G) + Bugs</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">see STATUS file</fo:block> + + + + + + + <fo:block id="sec8" font-size="18pt" font-family="serif" line-height="20pt" space-before.optimum="20pt" space-after.optimum="14pt" >H) + Compiling FOP</fo:block> + + <fo:block font-size="16pt" font-family="serif" line-height="18pt" space-before.optimum="8pt" space-after.optimum="8pt" >1. Prerequisites</fo:block> + + <fo:block font-size="14pt" font-family="serif" line-height="16pt" space-before.optimum="8pt" space-after.optimum="4pt" >a) Java 1.1.x or later</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">If you use Java 1.1.x you must also seperately include the swing classes, which can + be found at the <fo:inline font-style="italic" font-family="serif"> + Sun website</fo:inline> +<fo:inline font-family="serif"> + (http://java.sun.com/products/jfc/#download-swing) + </fo:inline>. From Java 1.2 on (aka Java 2) they are part of the standard + distribution. + </fo:block> + + + <fo:block font-size="14pt" font-family="serif" line-height="16pt" space-before.optimum="8pt" space-after.optimum="4pt" >b) An XML parser</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">An XML parser which supports DOM like + <fo:inline font-style="italic" font-family="serif">Xerces-J</fo:inline> +<fo:inline font-family="serif"> + (http://xml.apache.org/xerces-j/index.html) + </fo:inline>.</fo:block> + + + <fo:block font-size="14pt" font-family="serif" line-height="16pt" space-before.optimum="8pt" space-after.optimum="4pt" >c) XT from James Clark</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">Some of the Java source code in FOP is generated from XML using + XSLT. XT must be used to generate this code.</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">XT is an XSL stylesheet processor written in java. At the moment you + can't use any other processor, because the make file makes use of some + proprietary features of Clark's xt which allow to write output in more + then one document. You can find XT at <fo:inline font-style="italic" font-family="serif"> + James Clark's website</fo:inline> +<fo:inline font-family="serif"> + (http://www.jclark.com/xml/xt.html) + </fo:inline>. You have to use XT version 19991105 or later.</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">(Under windows you shouldn't use the prepackaged xt.exe but also the + generic jar file, otherwise make won't work) + </fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">XT relies on an sax parser like XP (also J. Clark), which can be + downloaded at <fo:inline font-style="italic" font-family="serif">James + Clark's Website</fo:inline> +<fo:inline font-family="serif"> + (http://www.jclark.com/xml/xp/index.html) + </fo:inline> + </fo:block> + + + <fo:block font-size="14pt" font-family="serif" line-height="16pt" space-before.optimum="8pt" space-after.optimum="4pt" >d) make</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">Under windows it has been reported that the use of the cygnus solutions port + of the GNU utilities works. You can find it at + <fo:inline font-style="italic" font-family="serif">Cygnus Solutions</fo:inline> +<fo:inline font-family="serif"> + (http://sourceware.cygnus.com/cygwin/) + </fo:inline> + </fo:block> + + + + <fo:block font-size="16pt" font-family="serif" line-height="18pt" space-before.optimum="8pt" space-after.optimum="8pt" >Compiling FOP on MacOS</fo:block> + + <fo:block space-after.optimum="3pt" font-family="serif">We strongly recommend the use of Codewarrior Java. This Readme will + contain a link to more information in the near future. + </fo:block> + + + + + + + + <fo:block id="sec9" font-size="18pt" font-family="serif" line-height="20pt" space-before.optimum="20pt" space-after.optimum="14pt" >I) + Getting involved</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">1. Subscribe to fop-dev@xml.apache.org by sending an email + to fop-dev-subscribe@xml.apache.org</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">2. Read the archives to fop-dev to get an idea of the issues being + discussed. </fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">3. Subscribe to fop-cvs@xml.apache.org by sending an email to + fop-cvs-subscribe@xml.apache.org (it is important + that you follow changes being made). </fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">4. Try :-) to wrap your head around the XSL working draft. </fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">5. Get CVS working on your system. </fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">6. Ask, on fop-dev, any questions you have at all about the code, design, etc. </fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">7. When you feel comfortable modifying the code, send diffs to + fop-dev with your contributions. </fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">8. Have fun!</fo:block> + + + + + + + <fo:block id="sec10" font-size="18pt" font-family="serif" line-height="20pt" space-before.optimum="20pt" space-after.optimum="14pt" >J) + FOP Relevant Specifications</fo:block> + <fo:list-block start-indent="1cm" provisional-distance-between-starts="12pt" font-family="serif"> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block> +<fo:inline font-style="italic" font-family="serif">XML Recommendation</fo:inline> +<fo:inline font-family="serif" > + (<fo:basic-link color="blue" external-destination="http://www.w3.org/TR/REC-xml">http://www.w3.org/TR/REC-xml</fo:basic-link>) + </fo:inline> +</fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block> +<fo:inline font-style="italic" font-family="serif">XSL-FO Working Draft</fo:inline> +<fo:inline font-family="serif"> + (<fo:basic-link color="blue" external-destination="http://www.w3.org/TR/WD-xsl/">http://www.w3.org/TR/WD-xsl/</fo:basic-link>) + </fo:inline> +</fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block> +<fo:inline font-style="italic" font-family="serif">XSLT Recommendation</fo:inline> +<fo:inline font-family="serif"> + (<fo:basic-link color="blue" external-destination="http://www.w3.org/TR/xslt">http://www.w3.org/TR/xslt</fo:basic-link>) + </fo:inline> +</fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block> +<fo:inline font-style="italic" font-family="serif">PDF Documentation</fo:inline> +<fo:inline font-family="serif"> + (<fo:basic-link color="blue" external-destination="http://partners.adobe.com/asn/developer/acrosdk/DOCS/pdfspec.pdf">http://partners.adobe.com/asn/developer/acrosdk/DOCS/pdfspec.pdf</fo:basic-link>) + </fo:inline> +</fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block> +<fo:inline font-style="italic" font-family="serif">Simple API for XML (SAX)</fo:inline> +<fo:inline font-family="serif"> + (<fo:basic-link color="blue" external-destination="http://www.megginson.com/SAX/">http://www.megginson.com/SAX/</fo:basic-link>) + </fo:inline> +</fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block> +<fo:inline font-style="italic" font-family="serif">Document Object Model (DOM)</fo:inline> +<fo:inline font-family="serif"> + (<fo:basic-link color="blue" external-destination="http://www.w3.org/TR/REC-DOM-Level-1">http://www.w3.org/TR/REC-DOM-Level-1</fo:basic-link>) + </fo:inline> +</fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block> +<fo:inline font-style="italic" font-family="serif">Namespaces in XML Recommendation</fo:inline> +<fo:inline font-family="serif"> + (<fo:basic-link color="blue" external-destination="http://www.w3.org/TR/REC-xml-names/">http://www.w3.org/TR/REC-xml-names/</fo:basic-link>) + </fo:inline> +</fo:block> +</fo:list-item-body> +</fo:list-item> + <fo:list-item> +<fo:list-item-label> +<fo:block><fo:inline font-family="Symbol">·</fo:inline></fo:block> +</fo:list-item-label> +<fo:list-item-body> +<fo:block> +<fo:inline font-style="italic" font-family="serif">Java JDK 1.1 Documentation</fo:inline> +<fo:inline font-family="serif"> + (<fo:basic-link color="blue" external-destination="http://java.sun.com/products/jdk/1.1/docs/index.html">http://java.sun.com/products/jdk/1.1/docs/index.html</fo:basic-link>) + </fo:inline> +</fo:block> +</fo:list-item-body> +</fo:list-item> + </fo:list-block> + + + + + + + <fo:block id="sec11" font-size="18pt" font-family="serif" line-height="20pt" space-before.optimum="20pt" space-after.optimum="14pt" >K) + Licence</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif"> ============================================================================</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif"> The Apache Software License, Version 1.1</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif"> ============================================================================</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif"> Copyright (C) 1999 The Apache Software Foundation. All rights reserved.</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif"> Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met:</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + </fo:block> + + <fo:block space-after.optimum="3pt" font-family="serif">2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + </fo:block> + + <fo:block space-after.optimum="3pt" font-family="serif">3. The end-user documentation included with the redistribution, if any, must + include the following acknowledgment: "This product includes software + developed by the Apache Software Foundation (http://www.apache.org/)." + Alternately, this acknowledgment may appear in the software itself, if + and wherever such third-party acknowledgments normally appear. + </fo:block> + + <fo:block space-after.optimum="3pt" font-family="serif">4. The names "FOP" and "Apache Software Foundation" must not be used to + endorse or promote products derived from this software without prior + written permission. For written permission, please contact + apache@apache.org. + </fo:block> + + <fo:block space-after.optimum="3pt" font-family="serif">5. Products derived from this software may not be called "Apache", nor may + "Apache" appear in their name, without prior written permission of the + Apache Software Foundation. + </fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- + DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + </fo:block> + + <fo:block space-after.optimum="3pt" font-family="serif"> + This software consists of voluntary contributions made by many individuals + on behalf of the Apache Software Foundation and was originally created by + James Tauber <jtauber@jtauber.com>. For more information on the Apache + Software Foundation, please see <fo:inline font-style="italic" font-family="serif">http://www.apache.org/</fo:inline> +<fo:inline font-family="serif"> + (http://www.apache.org/) + </fo:inline>. + </fo:block> + +<fo:block font-size="14pt" font-family="sans-serif" line-height="10pt" space-after.optimum="15pt" font-weight="bold" start-indent="15pt" break-before="page"> + Content + </fo:block> +<fo:table> +<fo:table-column column-width="1cm"/> +<fo:table-column column-width="12cm"/> +<fo:table-column column-width="1cm"/> +<fo:table-body font-size="10pt" font-family="sans-serif"> +<fo:table-row line-height="12pt"> +<fo:table-cell> +<fo:block text-align="end">A) + </fo:block> +</fo:table-cell> +<fo:table-cell> +<fo:block text-align="start"><fo:basic-link color="blue" internal-destination="sec1">What is FOP?</fo:basic-link></fo:block> +</fo:table-cell> +<fo:table-cell> +<fo:block text-align="end"><fo:page-number-citation ref-id="sec1"/></fo:block> +</fo:table-cell> +</fo:table-row> +<fo:table-row line-height="12pt"> +<fo:table-cell> +<fo:block text-align="end">B) + </fo:block> +</fo:table-cell> +<fo:table-cell> +<fo:block text-align="start"><fo:basic-link color="blue" internal-destination="sec2">Downloading FOP</fo:basic-link></fo:block> +</fo:table-cell> +<fo:table-cell> +<fo:block text-align="end"><fo:page-number-citation ref-id="sec2"/></fo:block> +</fo:table-cell> +</fo:table-row> +<fo:table-row line-height="12pt"> +<fo:table-cell> +<fo:block text-align="end">C) + </fo:block> +</fo:table-cell> +<fo:table-cell> +<fo:block text-align="start"><fo:basic-link color="blue" internal-destination="sec3">Running FOP</fo:basic-link></fo:block> +</fo:table-cell> +<fo:table-cell> +<fo:block text-align="end"><fo:page-number-citation ref-id="sec3"/></fo:block> +</fo:table-cell> +</fo:table-row> +<fo:table-row line-height="12pt"> +<fo:table-cell> +<fo:block text-align="end">D) + </fo:block> +</fo:table-cell> +<fo:table-cell> +<fo:block text-align="start"><fo:basic-link color="blue" internal-destination="sec4">Embedding FOP</fo:basic-link> </fo:block> +</fo:table-cell> +<fo:table-cell> +<fo:block text-align="end"><fo:page-number-citation ref-id="sec4"/></fo:block> +</fo:table-cell> +</fo:table-row> +<fo:table-row line-height="12pt"> +<fo:table-cell> +<fo:block text-align="end">E) + </fo:block> +</fo:table-cell> +<fo:table-cell> +<fo:block text-align="start"><fo:basic-link color="blue" internal-destination="sec5">What's Implemented?</fo:basic-link></fo:block> +</fo:table-cell> +<fo:table-cell> +<fo:block text-align="end"><fo:page-number-citation ref-id="sec5"/></fo:block> +</fo:table-cell> +</fo:table-row> +<fo:table-row line-height="12pt"> +<fo:table-cell> +<fo:block text-align="end">F) + </fo:block> +</fo:table-cell> +<fo:table-cell> +<fo:block text-align="start"><fo:basic-link color="blue" internal-destination="sec6">Limitations</fo:basic-link></fo:block> +</fo:table-cell> +<fo:table-cell> +<fo:block text-align="end"><fo:page-number-citation ref-id="sec6"/></fo:block> +</fo:table-cell> +</fo:table-row> +<fo:table-row line-height="12pt"> +<fo:table-cell> +<fo:block text-align="end">G) + </fo:block> +</fo:table-cell> +<fo:table-cell> +<fo:block text-align="start"><fo:basic-link color="blue" internal-destination="sec7">Bugs</fo:basic-link></fo:block> +</fo:table-cell> +<fo:table-cell> +<fo:block text-align="end"><fo:page-number-citation ref-id="sec7"/></fo:block> +</fo:table-cell> +</fo:table-row> +<fo:table-row line-height="12pt"> +<fo:table-cell> +<fo:block text-align="end">H) + </fo:block> +</fo:table-cell> +<fo:table-cell> +<fo:block text-align="start"><fo:basic-link color="blue" internal-destination="sec8">Compiling FOP</fo:basic-link></fo:block> +</fo:table-cell> +<fo:table-cell> +<fo:block text-align="end"><fo:page-number-citation ref-id="sec8"/></fo:block> +</fo:table-cell> +</fo:table-row> +<fo:table-row line-height="12pt"> +<fo:table-cell> +<fo:block text-align="end">I) + </fo:block> +</fo:table-cell> +<fo:table-cell> +<fo:block text-align="start"><fo:basic-link color="blue" internal-destination="sec9">Getting involved</fo:basic-link></fo:block> +</fo:table-cell> +<fo:table-cell> +<fo:block text-align="end"><fo:page-number-citation ref-id="sec9"/></fo:block> +</fo:table-cell> +</fo:table-row> +<fo:table-row line-height="12pt"> +<fo:table-cell> +<fo:block text-align="end">J) + </fo:block> +</fo:table-cell> +<fo:table-cell> +<fo:block text-align="start"><fo:basic-link color="blue" internal-destination="sec10">FOP Relevant Specifications</fo:basic-link></fo:block> +</fo:table-cell> +<fo:table-cell> +<fo:block text-align="end"><fo:page-number-citation ref-id="sec10"/></fo:block> +</fo:table-cell> +</fo:table-row> +<fo:table-row line-height="12pt"> +<fo:table-cell> +<fo:block text-align="end">K) + </fo:block> +</fo:table-cell> +<fo:table-cell> +<fo:block text-align="start"><fo:basic-link color="blue" internal-destination="sec11">Licence</fo:basic-link></fo:block> +</fo:table-cell> +<fo:table-cell> +<fo:block text-align="end"><fo:page-number-citation ref-id="sec11"/></fo:block> +</fo:table-cell> +</fo:table-row> +</fo:table-body> +</fo:table> + + + +</fo:flow> +</fo:page-sequence> +</fo:root> diff --git a/lib/buildtools.jar b/lib/buildtools.jar Binary files differindex 5169b943a..e421b5877 100644 --- a/lib/buildtools.jar +++ b/lib/buildtools.jar diff --git a/src/codegen/extproperties.xml b/src/codegen/extproperties.xml new file mode 100644 index 000000000..b72277392 --- /dev/null +++ b/src/codegen/extproperties.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" ?> +<property-list family="Extension"> + <generic-property-list> + <property> + <name>external-destination</name> + <inherited>false</inherited> + <datatype>String</datatype> + <default></default> + </property> + <property> + <name>internal-destination</name> + <inherited>false</inherited> + <datatype>String</datatype> + <default></default> + </property> + + </generic-property-list> +</property-list>
\ No newline at end of file diff --git a/src/org/apache/fop/apps/CommandLine.java b/src/org/apache/fop/apps/CommandLine.java index e8b0889d8..f26ff7b9b 100644 --- a/src/org/apache/fop/apps/CommandLine.java +++ b/src/org/apache/fop/apps/CommandLine.java @@ -166,8 +166,10 @@ public class CommandLine { Version.getVersion()); driver.addElementMapping("org.apache.fop.fo.StandardElementMapping"); driver.addElementMapping("org.apache.fop.svg.SVGElementMapping"); + driver.addElementMapping("org.apache.fop.extensions.ExtensionElementMapping"); driver.addPropertyList("org.apache.fop.fo.StandardPropertyListMapping"); driver.addPropertyList("org.apache.fop.svg.SVGPropertyListMapping"); + driver.addPropertyList("org.apache.fop.extensions.ExtensionPropertyListMapping"); driver.buildFOTree(parser, fileInputSource(foFile)); driver.format(); driver.setOutputStream(new FileOutputStream(pdfFile)); diff --git a/src/org/apache/fop/apps/XalanCommandLine.java b/src/org/apache/fop/apps/XalanCommandLine.java index e413a9229..09ef2ccc7 100644 --- a/src/org/apache/fop/apps/XalanCommandLine.java +++ b/src/org/apache/fop/apps/XalanCommandLine.java @@ -300,8 +300,11 @@ public class XalanCommandLine { version); driver.addElementMapping("org.apache.fop.fo.StandardElementMapping"); driver.addElementMapping("org.apache.fop.svg.SVGElementMapping"); + driver.addElementMapping("org.apache.fop.extensions.ExtensionElementMapping"); driver.addPropertyList("org.apache.fop.fo.StandardPropertyListMapping"); driver.addPropertyList("org.apache.fop.svg.SVGPropertyListMapping"); + driver.addPropertyList("org.apache.fop.extensions.ExtensionPropertyListMapping"); + OutputStream stream = new BufferedOutputStream(new FileOutputStream(pdfFile)); driver.setOutputStream(stream); driver.buildFOTree(parser, new InputSource(reader)); diff --git a/src/org/apache/fop/datatypes/IDReferences.java b/src/org/apache/fop/datatypes/IDReferences.java index edeeba2ca..7dcc02b70 100644 --- a/src/org/apache/fop/datatypes/IDReferences.java +++ b/src/org/apache/fop/datatypes/IDReferences.java @@ -229,7 +229,7 @@ public class IDReferences { * @param id the id whose reference to use * @return reference to GoTo object */ - public String getInternalLinkGotToReference(String id) + public String getInternalLinkGoToReference(String id) { IDNode node = (IDNode)idReferences.get(id); return node.getInternalLinkGoToReference(); diff --git a/src/org/apache/fop/extensions/ExtensionElementMapping.java b/src/org/apache/fop/extensions/ExtensionElementMapping.java new file mode 100644 index 000000000..c3f1e5f4a --- /dev/null +++ b/src/org/apache/fop/extensions/ExtensionElementMapping.java @@ -0,0 +1,64 @@ +/*-- $Id$ -- + + ============================================================================ + The Apache Software License, Version 1.1 + ============================================================================ + + Copyright (C) 1999 The Apache Software Foundation. All rights reserved. + + Redistribution and use in source and binary forms, with or without modifica- + tion, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. The end-user documentation included with the redistribution, if any, must + include the following acknowledgment: "This product includes software + developed by the Apache Software Foundation (http://www.apache.org/)." + Alternately, this acknowledgment may appear in the software itself, if + and wherever such third-party acknowledgments normally appear. + + 4. The names "FOP" and "Apache Software Foundation" must not be used to + endorse or promote products derived from this software without prior + written permission. For written permission, please contact + apache@apache.org. + + 5. Products derived from this software may not be called "Apache", nor may + "Apache" appear in their name, without prior written permission of the + Apache Software Foundation. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- + DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + This software consists of voluntary contributions made by many individuals + on behalf of the Apache Software Foundation and was originally created by + James Tauber <jtauber@jtauber.com>. For more information on the Apache + Software Foundation, please see <http://www.apache.org/>. + + */ + +package org.apache.fop.extensions; + +import org.apache.fop.fo.*; + +public class ExtensionElementMapping implements ElementMapping { + + public static final String URI = "http://xml.apache.org/fop/extensions"; + + public void addToBuilder(TreeBuilder builder) { + builder.addMapping(URI, "outline", Outline.maker()); + builder.addMapping(URI, "label", Label.maker()); + } +} diff --git a/src/org/apache/fop/extensions/ExtensionObj.java b/src/org/apache/fop/extensions/ExtensionObj.java new file mode 100644 index 000000000..b508cf64b --- /dev/null +++ b/src/org/apache/fop/extensions/ExtensionObj.java @@ -0,0 +1,98 @@ +/*-- $Id$ -- + + ============================================================================ + The Apache Software License, Version 1.1 + ============================================================================ + + Copyright (C) 1999 The Apache Software Foundation. All rights reserved. + + Redistribution and use in source and binary forms, with or without modifica- + tion, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. The end-user documentation included with the redistribution, if any, must + include the following acknowledgment: "This product includes software + developed by the Apache Software Foundation (http://www.apache.org/)." + Alternately, this acknowledgment may appear in the software itself, if + and wherever such third-party acknowledgments normally appear. + + 4. The names "FOP" and "Apache Software Foundation" must not be used to + endorse or promote products derived from this software without prior + written permission. For written permission, please contact + apache@apache.org. + + 5. Products derived from this software may not be called "Apache", nor may + "Apache" appear in their name, without prior written permission of the + Apache Software Foundation. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- + DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + This software consists of voluntary contributions made by many individuals + on behalf of the Apache Software Foundation and was originally created by + James Tauber <jtauber@jtauber.com>. For more information on the Apache + Software Foundation, please see <http://www.apache.org/>. + + */ + +package org.apache.fop.extensions; + +import org.apache.fop.fo.*; +import org.apache.fop.layout.*; +import org.apache.fop.apps.FOPException; + +/** + * base class for extension objects + */ +public abstract class ExtensionObj extends FObj +{ + /** + * + * @param parent the parent formatting object + * @param propertyList the explicit properties of this object + */ + public ExtensionObj(FObj parent, PropertyList propertyList) { + super(parent, propertyList); + } + + /** + * Called for extensions within a page sequence or flow. These extensions + * are allowed to generate visible areas within the layout. + * + * + * @param area + */ + public Status layout(Area area) throws FOPException { + ExtensionArea extArea = new ExtensionArea(this); + area.addChild(extArea); + return new Status(Status.OK); + } + + + /** + * Called for root extensions. Root extensions aren't allowed to generate + * any visible areas. They are used for extra items that don't show up in + * the page layout itself. For example: pdf outlines + * + * @param areaTree + */ + public void format(AreaTree areaTree) throws FOPException { + ExtensionArea extArea = new ExtensionArea(this); + areaTree.addExtension(this); + } + +} diff --git a/src/org/apache/fop/extensions/ExtensionPropertyListMapping.java b/src/org/apache/fop/extensions/ExtensionPropertyListMapping.java new file mode 100644 index 000000000..029ea9996 --- /dev/null +++ b/src/org/apache/fop/extensions/ExtensionPropertyListMapping.java @@ -0,0 +1,77 @@ +/*-- $Id$ -- + + ============================================================================ + The Apache Software License, Version 1.1 + ============================================================================ + + Copyright (C) 1999 The Apache Software Foundation. All rights reserved. + + Redistribution and use in source and binary forms, with or without modifica- + tion, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. The end-user documentation included with the redistribution, if any, must + include the following acknowledgment: "This product includes software + developed by the Apache Software Foundation (http://www.apache.org/)." + Alternately, this acknowledgment may appear in the software itself, if + and wherever such third-party acknowledgments normally appear. + + 4. The names "FOP" and "Apache Software Foundation" must not be used to + endorse or promote products derived from this software without prior + written permission. For written permission, please contact + apache@apache.org. + + 5. Products derived from this software may not be called "Apache", nor may + "Apache" appear in their name, without prior written permission of the + Apache Software Foundation. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- + DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + This software consists of voluntary contributions made by many individuals + on behalf of the Apache Software Foundation and was originally created by + James Tauber <jtauber@jtauber.com>. For more information on the Apache + Software Foundation, please see <http://www.apache.org/>. + + */ + +package org.apache.fop.extensions; + + +import org.apache.fop.fo.properties.ExtensionPropertyMapping; +import org.apache.fop.fo.PropertyListMapping; +import org.apache.fop.fo.TreeBuilder; + +import java.util.Enumeration; +import java.util.Hashtable; + +public class ExtensionPropertyListMapping implements PropertyListMapping { + + public void addToBuilder(TreeBuilder builder) { + + builder.addPropertyList(ExtensionElementMapping.URI, + ExtensionPropertyMapping.getGenericMappings()); + /* Add any element mappings */ + for (Enumeration e = ExtensionPropertyMapping.getElementMappings(); + e.hasMoreElements();) { + String elem = (String)e.nextElement(); + builder.addElementPropertyList(ExtensionElementMapping.URI, elem, + ExtensionPropertyMapping.getElementMapping(elem)); + } + + } +} diff --git a/src/org/apache/fop/extensions/Label.java b/src/org/apache/fop/extensions/Label.java new file mode 100644 index 000000000..9849193a1 --- /dev/null +++ b/src/org/apache/fop/extensions/Label.java @@ -0,0 +1,86 @@ +/*-- $Id$ -- + + ============================================================================ + The Apache Software License, Version 1.1 + ============================================================================ + + Copyright (C) 1999 The Apache Software Foundation. All rights reserved. + + Redistribution and use in source and binary forms, with or without modifica- + tion, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. The end-user documentation included with the redistribution, if any, must + include the following acknowledgment: "This product includes software + developed by the Apache Software Foundation (http://www.apache.org/)." + Alternately, this acknowledgment may appear in the software itself, if + and wherever such third-party acknowledgments normally appear. + + 4. The names "FOP" and "Apache Software Foundation" must not be used to + endorse or promote products derived from this software without prior + written permission. For written permission, please contact + apache@apache.org. + + 5. Products derived from this software may not be called "Apache", nor may + "Apache" appear in their name, without prior written permission of the + Apache Software Foundation. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- + DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + This software consists of voluntary contributions made by many individuals + on behalf of the Apache Software Foundation and was originally created by + James Tauber <jtauber@jtauber.com>. For more information on the Apache + Software Foundation, please see <http://www.apache.org/>. + + */ + +package org.apache.fop.extensions; + +import org.apache.fop.fo.*; + + +public class Label extends ExtensionObj +{ + private String _label = ""; + + public static class Maker extends FObj.Maker { + public FObj make(FObj parent, PropertyList propertyList) + { + return new Label(parent, propertyList); + } + } + + public static FObj.Maker maker() { + return new Label.Maker(); + } + + public Label(FObj parent, PropertyList propertyList) { + super(parent, propertyList); + } + + protected void addCharacters(char data[], int start, int end) { + _label += new String(data, start, end-start); + } + + public String toString() + { + return _label; + } + + +} diff --git a/src/org/apache/fop/extensions/Outline.java b/src/org/apache/fop/extensions/Outline.java new file mode 100644 index 000000000..ee70ce529 --- /dev/null +++ b/src/org/apache/fop/extensions/Outline.java @@ -0,0 +1,156 @@ +/*-- $Id$ -- + + ============================================================================ + The Apache Software License, Version 1.1 + ============================================================================ + + Copyright (C) 1999 The Apache Software Foundation. All rights reserved. + + Redistribution and use in source and binary forms, with or without modifica- + tion, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. The end-user documentation included with the redistribution, if any, must + include the following acknowledgment: "This product includes software + developed by the Apache Software Foundation (http://www.apache.org/)." + Alternately, this acknowledgment may appear in the software itself, if + and wherever such third-party acknowledgments normally appear. + + 4. The names "FOP" and "Apache Software Foundation" must not be used to + endorse or promote products derived from this software without prior + written permission. For written permission, please contact + apache@apache.org. + + 5. Products derived from this software may not be called "Apache", nor may + "Apache" appear in their name, without prior written permission of the + Apache Software Foundation. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- + DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + This software consists of voluntary contributions made by many individuals + on behalf of the Apache Software Foundation and was originally created by + James Tauber <jtauber@jtauber.com>. For more information on the Apache + Software Foundation, please see <http://www.apache.org/>. + + */ + +package org.apache.fop.extensions; + +import org.apache.fop.fo.*; +import org.apache.fop.pdf.PDFGoTo; +import org.apache.fop.pdf.PDFAction; +import org.apache.fop.datatypes.IDReferences; +import org.apache.fop.messaging.MessageHandler; + +import java.util.*; + + +public class Outline extends ExtensionObj +{ + private Label _label; + private Vector _outlines = new Vector(); + + private String _internalDestination; + private String _externalDestination; + + /** The parent outline object if it exists */ + private Outline _parentOutline; + + /** an opaque renderer context object, e.g. PDFOutline for PDFRenderer */ + private Object _rendererObject; + + + public static class Maker extends FObj.Maker { + public FObj make(FObj parent, PropertyList propertyList) + { + return new Outline(parent, propertyList); + } + } + + public static FObj.Maker maker() { + return new Outline.Maker(); + } + + public Outline(FObj parent, PropertyList propertyList) { + super(parent, propertyList); + + _internalDestination = this.properties.get("internal-destination").getString(); + _externalDestination = this.properties.get("external-destination").getString(); + if (_externalDestination != null && !_externalDestination.equals("")) { + MessageHandler.errorln("WARNING: fox:outline external-destination not supported currently."); + } + + if (_internalDestination == null || _internalDestination.equals("")) { + MessageHandler.errorln("WARNING: fox:outline requires an internal-destination."); + } + + for (FONode node = getParent(); node != null; node = node.getParent()) { + if (node instanceof Outline) { + _parentOutline = (Outline)node; + break; + } + } + + } + + protected void addChild(FONode obj) + { + if (obj instanceof Label) { + _label = (Label)obj; + } + else if (obj instanceof Outline) { + _outlines.add(obj); + } + super.addChild(obj); + } + + + public void setRendererObject(Object o) + { + _rendererObject = o; + } + + public Object getRendererObject() + { + return _rendererObject; + } + + public Outline getParentOutline() + { + return _parentOutline; + } + + public Label getLabel() + { + return _label == null?new Label(this,this.properties):_label; + } + + public Vector getOutlines() + { + return _outlines; + } + + public String getInternalDestination() + { + return _internalDestination; + } + + + +} + diff --git a/src/org/apache/fop/fo/pagination/Root.java b/src/org/apache/fop/fo/pagination/Root.java index 23546b083..58eb8ab28 100644 --- a/src/org/apache/fop/fo/pagination/Root.java +++ b/src/org/apache/fop/fo/pagination/Root.java @@ -57,69 +57,79 @@ import org.apache.fop.fo.flow.*; import org.apache.fop.fo.properties.*; import org.apache.fop.layout.AreaTree; import org.apache.fop.apps.FOPException; +import org.apache.fop.extensions.ExtensionObj; // Java import java.util.Vector; import java.util.Enumeration; +/** + * The fo:root formatting object. Contains page masters, root extensions, + * page-sequences. + */ public class Root extends FObj { - public static class Maker extends FObj.Maker { - public FObj make(FObj parent, PropertyList propertyList) throws FOPException { - return new Root(parent, propertyList); - } - } - - public static FObj.Maker maker() + + public static class Maker extends FObj.Maker { + public FObj make(FObj parent, PropertyList propertyList) + throws FOPException { - return new Root.Maker(); - } - - LayoutMasterSet layoutMasterSet; - Vector pageSequences; - - protected Root(FObj parent, PropertyList propertyList) throws FOPException - { - super(parent, propertyList); - this.name = "fo:root"; - - pageSequences = new Vector(); - if (parent != null) - { - throw new FOPException("root must be root element"); - } - } - - - public void addPageSequence(PageSequence pageSequence) - { - this.pageSequences.addElement(pageSequence); - } - - - public LayoutMasterSet getLayoutMasterSet() - { - return this.layoutMasterSet; + return new Root(parent, propertyList); } + } + public static FObj.Maker maker() + { + return new Root.Maker(); + } - public void format(AreaTree areaTree) throws FOPException - { -// MessageHandler.errorln(" Root[" + marker + "] "); - if(layoutMasterSet == null) - { - throw new FOPException("No layout master set."); - } + LayoutMasterSet layoutMasterSet; + Vector pageSequences; - Enumeration e = pageSequences.elements(); - while (e.hasMoreElements()) - { - ((PageSequence) e.nextElement()).format(areaTree); - } + protected Root(FObj parent, PropertyList propertyList) throws FOPException + { + super(parent, propertyList); + this.name = "fo:root"; - } + pageSequences = new Vector(); + if (parent != null) + { + throw new FOPException("root must be root element"); + } + } + /** @deprecated handled by addChild now + */ + public void addPageSequence(PageSequence pageSequence) + { + this.pageSequences.addElement(pageSequence); + } + + + public LayoutMasterSet getLayoutMasterSet() + { + return this.layoutMasterSet; + } public void setLayoutMasterSet(LayoutMasterSet layoutMasterSet) { this.layoutMasterSet = layoutMasterSet; } + + public void format(AreaTree areaTree) throws FOPException + { + // MessageHandler.errorln(" Root[" + marker + "] "); + if(layoutMasterSet == null) { + throw new FOPException("No layout master set."); + } + + Enumeration e = children.elements(); + while (e.hasMoreElements()) { + Object o = e.nextElement(); + if (o instanceof PageSequence) { + ((PageSequence) o).format(areaTree); + } + else if (o instanceof ExtensionObj) { + ((ExtensionObj)o).format(areaTree); + } + } + } } diff --git a/src/org/apache/fop/layout/AreaTree.java b/src/org/apache/fop/layout/AreaTree.java index 5b6574346..14f9377bf 100644 --- a/src/org/apache/fop/layout/AreaTree.java +++ b/src/org/apache/fop/layout/AreaTree.java @@ -56,6 +56,7 @@ import org.apache.fop.fo.flow.StaticContent; import org.apache.fop.svg.*; import org.apache.fop.render.Renderer; import org.apache.fop.datatypes.IDReferences; +import org.apache.fop.extensions.ExtensionObj; // Java import java.io.IOException; @@ -73,6 +74,10 @@ public class AreaTree { /* list of all the pages */ Vector pageList = new Vector(); + /** List of root extension objects */ + Vector rootExtensions = new Vector(); + + IDReferences idReferences = new IDReferences(); public void setFontInfo(FontInfo fontInfo) { @@ -95,4 +100,16 @@ public class AreaTree { { return idReferences; } + + public void addExtension(ExtensionObj obj) + { + rootExtensions.addElement(obj); + } + + public Vector getExtensions() + { + return rootExtensions; + } + + } diff --git a/src/org/apache/fop/layout/ExtensionArea.java b/src/org/apache/fop/layout/ExtensionArea.java new file mode 100644 index 000000000..4d9d40795 --- /dev/null +++ b/src/org/apache/fop/layout/ExtensionArea.java @@ -0,0 +1,79 @@ +/*-- $Id$ -- + + ============================================================================ + The Apache Software License, Version 1.1 + ============================================================================ + + Copyright (C) 1999 The Apache Software Foundation. All rights reserved. + + Redistribution and use in source and binary forms, with or without modifica- + tion, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. The end-user documentation included with the redistribution, if any, must + include the following acknowledgment: "This product includes software + developed by the Apache Software Foundation (http://www.apache.org/)." + Alternately, this acknowledgment may appear in the software itself, if + and wherever such third-party acknowledgments normally appear. + + 4. The names "FOP" and "Apache Software Foundation" must not be used to + endorse or promote products derived from this software without prior + written permission. For written permission, please contact + apache@apache.org. + + 5. Products derived from this software may not be called "Apache", nor may + "Apache" appear in their name, without prior written permission of the + Apache Software Foundation. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- + DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + This software consists of voluntary contributions made by many individuals + on behalf of the Apache Software Foundation and was originally created by + James Tauber <jtauber@jtauber.com>. For more information on the Apache + Software Foundation, please see <http://www.apache.org/>. + + */ + +package org.apache.fop.layout; + +import org.apache.fop.fo.*; + +import org.apache.fop.extensions.*; +import org.apache.fop.render.*; + +public class ExtensionArea extends Area +{ + private ExtensionObj _extensionObj; + + public ExtensionArea (ExtensionObj obj) { + super(null); + _extensionObj = obj; + } + + public FObj getExtensionObj() + { + return _extensionObj; + } + + public void render(Renderer renderer) + { + // renderer.renderExtensionArea(this); + } + + +} diff --git a/src/org/apache/fop/pdf/PDFDocument.java b/src/org/apache/fop/pdf/PDFDocument.java index 7adcbb174..7f55fda80 100644 --- a/src/org/apache/fop/pdf/PDFDocument.java +++ b/src/org/apache/fop/pdf/PDFDocument.java @@ -899,30 +899,34 @@ public class PDFDocument { } } else { // linkType is internal - String goToReference; - PDFInternalLink internalLink; - - if ( idReferences.doesIDExist(destination) ) { - if ( idReferences.doesGoToReferenceExist(destination) ) { - goToReference = idReferences.getInternalLinkGotToReference(destination); - } - else { //assign Internal Link GoTo object - goToReference = idReferences.createInternalLinkGoTo(destination,++this.objectcount); - this.objects.addElement(idReferences.getPDFGoTo(destination)); - } - } - else { //id was not found, so create it - idReferences.createNewId(destination); - idReferences.addToIdValidationList(destination); - goToReference = idReferences.createInternalLinkGoTo(destination,++this.objectcount); - this.objects.addElement(idReferences.getPDFGoTo(destination)); - } - internalLink = new PDFInternalLink(goToReference); + String goToReference = getGoToReference(destination); + PDFInternalLink internalLink = new PDFInternalLink(goToReference); link.setAction(internalLink); } return link; } + private String getGoToReference(String destination) + { + String goToReference; + if ( idReferences.doesIDExist(destination) ) { + if ( idReferences.doesGoToReferenceExist(destination) ) { + goToReference = idReferences.getInternalLinkGoToReference(destination); + } + else { //assign Internal Link GoTo object + goToReference = idReferences.createInternalLinkGoTo(destination,++this.objectcount); + this.objects.addElement(idReferences.getPDFGoTo(destination)); + } + } + else { //id was not found, so create it + idReferences.createNewId(destination); + idReferences.addToIdValidationList(destination); + goToReference = idReferences.createInternalLinkGoTo(destination,++this.objectcount); + this.objects.addElement(idReferences.getPDFGoTo(destination)); + } + return goToReference; + } + /** * make a stream object @@ -957,6 +961,40 @@ public class PDFDocument { } /** + * Make the root Outlines object + */ + public PDFOutline makeOutlineRoot() + { + PDFOutline obj = new PDFOutline(++this.objectcount, null, null); + this.objects.addElement(obj); + root.setRootOutline(obj); + + return obj; + } + + /** Make an outline object and add it to the given outline + * @param parent parent PDFOutline object + * @param label the title for the new outline object + * @param action the PDFAction to reference + */ + public PDFOutline makeOutline(PDFOutline parent, + String label, + String destination) + { + String goToRef = getGoToReference(destination); + + PDFOutline obj = new PDFOutline(++this.objectcount, label, goToRef); + // System.out.println("created new outline object"); + + if (parent != null) { + parent.addOutline(obj); + } + this.objects.addElement(obj); + return obj; + + } + + /** * get the /Resources object for the document * * @return the /Resources object diff --git a/src/org/apache/fop/pdf/PDFGoTo.java b/src/org/apache/fop/pdf/PDFGoTo.java index 60862d024..e88658fd5 100644 --- a/src/org/apache/fop/pdf/PDFGoTo.java +++ b/src/org/apache/fop/pdf/PDFGoTo.java @@ -55,7 +55,7 @@ package org.apache.fop.pdf; * class representing a /GoTo object. * */ -public class PDFGoTo extends PDFObject { +public class PDFGoTo extends PDFAction { /** the pageReference */ protected String pageReference; @@ -113,6 +113,11 @@ public class PDFGoTo extends PDFObject { this.xPosition = (xPosition/1000f); } + public String getAction() + { + return referencePDF(); + } + /** * represent the object in PDF diff --git a/src/org/apache/fop/pdf/PDFOutline.java b/src/org/apache/fop/pdf/PDFOutline.java new file mode 100644 index 000000000..0f4e8a1e6 --- /dev/null +++ b/src/org/apache/fop/pdf/PDFOutline.java @@ -0,0 +1,218 @@ +/*-- $Id$ -- + + ============================================================================ + The Apache Software License, Version 1.1 + ============================================================================ + + Copyright (C) 1999 The Apache Software Foundation. All rights reserved. + + Redistribution and use in source and binary forms, with or without modifica- + tion, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. The end-user documentation included with the redistribution, if any, must + include the following acknowledgment: "This product includes software + developed by the Apache Software Foundation (http://www.apache.org/)." + Alternately, this acknowledgment may appear in the software itself, if + and wherever such third-party acknowledgments normally appear. + + 4. The names "FOP" and "Apache Software Foundation" must not be used to + endorse or promote products derived from this software without prior + written permission. For written permission, please contact + apache@apache.org. + + 5. Products derived from this software may not be called "Apache", nor may + "Apache" appear in their name, without prior written permission of the + Apache Software Foundation. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- + DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + This software consists of voluntary contributions made by many individuals + on behalf of the Apache Software Foundation and was originally created by + James Tauber <jtauber@jtauber.com>. For more information on the Apache + Software Foundation, please see <http://www.apache.org/>. + + */ + +package org.apache.fop.pdf; + +import java.util.Vector; + + +/** + * This represents a single Outline object in a PDF, including the root Outlines + * object. Outlines provide the bookmark bar, usually rendered to the right of + * a PDF document in user agents such as Acrobat Reader + * + * @author Kelly A. Campbell + * + */ + +public class PDFOutline extends PDFObject +{ + + /** list of sub-entries (outline objects) */ + private Vector _subentries; + + /** parent outline object. Root Outlines parent is null */ + private PDFOutline _parent; + + private PDFOutline _prev; + private PDFOutline _next; + + private PDFOutline _first; + private PDFOutline _last; + + private int _count; + + + /** title to display for the bookmark entry */ + private String _title; + + String _actionRef; + + + + /** + * @param number the object id number + * @param title the title of the outline entry (can only be null for root Outlines obj) + * @param page the page which this outline refers to. + */ + public PDFOutline(int number, String title, String action) + { + super(number); + _subentries = new Vector(); + _count = 0; + _parent = null; + _prev = null; + _next = null; + _first = null; + _last = null; + _title = title; + _actionRef = action; + + + } + + public void setTitle(String title) + { + _title = title; + } + + /** + * Add a sub element to this outline + */ + public void addOutline(PDFOutline outline) + { + if (_subentries.size() > 0) { + outline._prev = (PDFOutline)_subentries.elementAt(_subentries.size() - 1); + outline._prev._next = outline; + } + else { + _first = outline; + } + + _subentries.addElement(outline); + outline._parent = this; + + incrementCount(); // note: count is not just the immediate children + + _last = outline; + + } + + private void incrementCount() + { + // count is a total of our immediate subentries and all descendent subentries + _count++; + if (_parent != null) { + _parent.incrementCount(); + } + } + + + /** represent the object in PDF */ + protected byte[] toPDF() + { + StringBuffer result = new StringBuffer(this.number+" "+this.generation+" obj\n<<\n"); + if (_parent == null) { + // root Outlines object + if (_first != null && _last != null) { + result.append(" /First "+_first.referencePDF()+"\n"); + result.append(" /Last "+_last.referencePDF()+"\n"); + // no count... we start with the outline completely closed for now + } + } + else { + // subentry Outline object + result.append(" /Title ("+escapeString(_title)+")\n"); + result.append(" /Parent "+_parent.referencePDF()+"\n"); + if (_first != null && _last != null) { + result.append(" /First "+_first.referencePDF()+"\n"); + result.append(" /Last "+_last.referencePDF()+"\n"); + } + if (_prev != null) { + result.append(" /Prev "+_prev.referencePDF()+"\n"); + } + if (_next != null) { + result.append(" /Next "+_next.referencePDF()+"\n"); + } + if (_count > 0) { + result.append(" /Count -"+_count+"\n"); + } + + if (_actionRef != null) { + result.append(" /A "+_actionRef+"\n"); + } + + + } + result.append(">> endobj\n"); + return result.toString().getBytes(); + + } + + /** escape parens, and other special chars for PDF */ + private String escapeString(String s) + { + StringBuffer result = new StringBuffer(); + if (s != null) { + int l = s.length(); + + for (int i = 0; i < l; i++) { + char ch = s.charAt(i); + if (ch > 127) { + result.append("\\"); + result.append(Integer.toOctalString((int) ch)); + } else { + switch (ch) { + case '(' : + case ')' : + case '\\' : + result.append('\\'); + break; + } + result.append(ch); + } + } + } + + return result.toString(); + } + +} diff --git a/src/org/apache/fop/pdf/PDFRoot.java b/src/org/apache/fop/pdf/PDFRoot.java index 92a8a7839..f31543eab 100644 --- a/src/org/apache/fop/pdf/PDFRoot.java +++ b/src/org/apache/fop/pdf/PDFRoot.java @@ -62,6 +62,9 @@ public class PDFRoot extends PDFObject { /** the /Pages object that is root of the Pages hierarchy */ protected PDFPages rootPages; + /** Root outline object */ + private PDFOutline _outline; + /** * create a Root (/Catalog) object * @@ -89,15 +92,27 @@ public class PDFRoot extends PDFObject { this.rootPages = pages; } + public void setRootOutline(PDFOutline outline) + { + _outline = outline; + } + + /** * represent the object as PDF * * @return the PDF string */ public byte[] toPDF() { - String p = this.number + " " + this.generation + StringBuffer p = new StringBuffer(this.number + " " + this.generation + " obj\n<< /Type /Catalog\n/Pages " - + this.rootPages.referencePDF() + " >>\nendobj\n"; - return p.getBytes(); + + this.rootPages.referencePDF() + "\n"); + if (_outline != null) { + p.append(" /Outlines "+_outline.referencePDF()+"\n"); + p.append(" /PageMode /UseOutlines\n"); + + } + p.append(" >>\nendobj\n"); + return p.toString().getBytes(); } } diff --git a/src/org/apache/fop/render/pdf/PDFRenderer.java b/src/org/apache/fop/render/pdf/PDFRenderer.java index 28c9561c3..45f4534eb 100644 --- a/src/org/apache/fop/render/pdf/PDFRenderer.java +++ b/src/org/apache/fop/render/pdf/PDFRenderer.java @@ -66,6 +66,8 @@ import org.apache.fop.pdf.*; import org.apache.fop.layout.*; import org.apache.fop.image.*; import org.apache.fop.configuration.Configuration; +import org.apache.fop.extensions.*; +import org.apache.fop.datatypes.IDReferences; import org.w3c.dom.*; import org.w3c.dom.svg.*; @@ -175,6 +177,7 @@ public class PDFRenderer implements Renderer { boolean useKerning; + private PDFOutline rootOutline; /** * create the PDF renderer @@ -219,7 +222,8 @@ public class PDFRenderer implements Renderer { idReferences.getInvalidIds() + "\n"); } - + renderRootExtensions(areaTree); + MessageHandler.logln("writing out PDF"); this.pdfDoc.output(stream); } @@ -1021,4 +1025,53 @@ public class PDFRenderer implements Renderer { return rs; } + protected void renderRootExtensions(AreaTree areaTree) + { + Vector v = areaTree.getExtensions(); + if (v != null) { + Enumeration e = v.elements(); + while (e.hasMoreElements()) { + ExtensionObj ext = (ExtensionObj)e.nextElement(); + if (ext instanceof Outline) { + renderOutline((Outline)ext); + } + } + } + + } + + private void renderOutline(Outline outline) + { + if (rootOutline == null) { + rootOutline = this.pdfDoc.makeOutlineRoot(); + } + PDFOutline pdfOutline = null; + Outline parent = outline.getParentOutline(); + if (parent == null) { + pdfOutline = this.pdfDoc.makeOutline(rootOutline, + outline.getLabel().toString(), + outline.getInternalDestination()); + } + else { + PDFOutline pdfParentOutline = (PDFOutline)parent.getRendererObject(); + if (pdfParentOutline == null) { + MessageHandler.errorln("Error: pdfParentOutline is null"); + } + else { + pdfOutline = this.pdfDoc.makeOutline(pdfParentOutline, + outline.getLabel().toString(), + outline.getInternalDestination()); + } + + } + outline.setRendererObject(pdfOutline); + + // handle sub outlines + Vector v = outline.getOutlines(); + Enumeration e = v.elements(); + while (e.hasMoreElements()) { + renderOutline((Outline)e.nextElement()); + } + } + } diff --git a/src/org/apache/fop/tools/anttasks/Fop.java b/src/org/apache/fop/tools/anttasks/Fop.java index 25c3946a7..a0eb542a0 100644 --- a/src/org/apache/fop/tools/anttasks/Fop.java +++ b/src/org/apache/fop/tools/anttasks/Fop.java @@ -194,8 +194,11 @@ public class Fop { version); driver.addElementMapping("org.apache.fop.fo.StandardElementMapping"); driver.addElementMapping("org.apache.fop.svg.SVGElementMapping"); + driver.addElementMapping("org.apache.fop.extensions.ExtensionElementMapping"); driver.addPropertyList("org.apache.fop.fo.StandardPropertyListMapping"); driver.addPropertyList("org.apache.fop.svg.SVGPropertyListMapping"); + driver.addPropertyList("org.apache.fop.extensions.ExtensionPropertyListMapping"); + driver.setOutputStream(new FileOutputStream(pdffile)); driver.buildFOTree(parser, fileInputSource(fofile)); driver.format(); |