You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Michael König <Mi...@ms-koenig.de> on 2001/12/28 13:03:43 UTC

create pdf from XSL-file and DOM-Tree

Hello,

in my applikation I create a DOM-Tree dynamically (not from a XML-file)
representing the data.

Also, I have a XSL-file representing the layout.

Now I would like to create a PDF-file from these to sources.
But the only way I see by now is to create PDF from an XML-file together
with the XSL.

I could think of something like this:

++++++++++++++++++++++++++++++++++++++++++++
 ...
 Document theDoc = ....
 DocumentInputSource theDISource = new DocumentInputSource( theDoc );

 Driver driver = new Driver(theDISource ,
				    new FileOutputStream("pdfFile_Name") );
 driver.setRenderer(RENDER_PDF);
 driver.run();
+++++++++++++++++++++++++++++++++++++++++++++


but how can I include the layout-information?

If I run to above example I get the following output/exception

+++++++++++++++++++++++++++++++++
building formatting object tree
setting up fonts
java.lang.NullPointerException
        at java.util.Hashtable.get(Hashtable.java:320)
        at
org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:191)
        at
org.apache.fop.tools.DocumentReader.parse(DocumentReader.java:444)
        at org.apache.fop.apps.Driver.render(Driver.java:449)
        at org.apache.fop.apps.Driver.run(Driver.java:506)
        at
de.koenig.rechnung.Mahnung_Englisch.createMahnung(Mahnung_Englisch.java:66)
        at
de.koenig.rechnung.Mahnung_Englisch.main(Mahnung_Englisch.java:96)
+++++++++++++++++++++++++++++++++


The used Document is correct and works together with the XSL correctly (by
now I do create
the Document from a XML-file, but i plan to create it dynamically as told
above)

Thanks,
Michael