Re: render DOM to PDF with FOP

2002-06-12 Thread Jochen . Maes

to parse the xml:

 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document XMLDoc = db.parse(source);
System.out.println("file gevonden");
prop.put(targetKey, XMLDoc);

to parse the xsl:
 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
DocumentBuilder db = dbf.newDocumentBuilder();
inFile =  new File((String)initprops.get(key));
Document XSLDoc = db.parse(inFile);
TransformDocs.put(key, XSLDoc);

to transfer the xsl :
   transForm = transFactory.newTransformer(new DOMSource
((Node)TransformDocs.get(((String)props.get(languageKey)) + "_XSL")));
res = new DOMResult();
transForm.setOutputProperty("omit-xml-declaration", "yes");
transForm.transform(new DOMSource
((Node)props.get(sourceKey)),res);

to render the pdf:

   Document res = (Document) props.get(sourceKey);
ByteArrayOutputStream baOs = new ByteArrayOutputStream();
driver.setOutputStream(baOs);
 // renderen van het PDF document
driver.render(res);
props.put(targetKey, baOs.toByteArray());
baOs.close();
baOs = null;
res = null;




Jochen Maes
ICT Development


KBC Securities (kbcsecurities.com)
Havenlaan 12 Avenue du Port SIF 8683
B-1080 Brussels
Belgium

 Tel:  +32 2 429 96 81  

 GSM:  +32 496 57 90 99 

 E-mail :  [EMAIL PROTECTED] 





This message and any attachments hereto are for the named person's use
only. It may contain confidential, proprietary or legally privileged
information. You may not, directly or indirectly, use, disclose,
distribute, print, or copy any part of this message if you are not the
intended recipient. If you have received this e-mail message without being
the intended recipient, please notify KBC Securities promptly and delete
this e-mail. Any views expressed in this message are those of the
individual sender, except where the message states otherwise and the sender
is authorised to state them to be the views of KBC Securities. KBC
Securities reserves the right to monitor all e-mail communications through
its networks and any messages addressed to, received or sent by KBC
Securities or its employees are deemed to be professional in nature. The
sender or recipient of any messages to or of KBC Securities agrees that
those may be read by other employees of KBC Securities than the stated
recipient or sender in order to ensure the continuity of work-related
activities and allow supervision thereof. KBC Securities does not accept
liability for the correct and complete transmission of the information, nor
for any delay or interruption of the transmission, nor for damages arising
from the use of, or reliance on, the information.



   
[EMAIL PROTECTED]   
   
e.comTo: [EMAIL PROTECTED]  
 
 cc:
   
12/06/2002   Subject: render DOM to PDF with 
FOP   
13:25   
   
Please  
   
respond to  
   
fop-user
   

   

   




Hi,

I have seen in the FopServlet example how to embed the FOP in the servlet.
But the problem is that XSLTInputHandler been used in renderXML method only
takes xml file and xsl file. How can I set up FOP to render a in-memory DOM
object with a specified xsl file to PDF without having to write the DOM out
to a temporary disk file?

Thanks,
___
Jianbo Mao
CheckFree i-Solutions
Email: [EMAIL PROTECTED]
Office:  +44 (0) 1753 567896
Mobile: +44 (0) 7810 483974
Fax:  +44 (0) 1753 567897

Re: render DOM to PDF with FOP

2002-06-12 Thread Louis . Masters

Check the list's archive, but I believe it is something like this:

transformer.transform( new SAXSource( new InputSource ( new StringReader (
xml ) ) ), new SAXResult(driver.getContentHandler() ));

change the SAXSource to a DOMSource and check out the DOMSource object.


The xsl file is read like:

Transformer transformer = transformerFactory.newTransformer(new
javax.xml.transform.stream.StreamSource(xsl));

where xsl is the xsl file.

-Lou




[EMAIL PROTECTED] on 06/12/2002 07:25:05 AM

Please respond to [EMAIL PROTECTED]

To:   [EMAIL PROTECTED]
cc:

Subject:  render DOM to PDF with FOP

Hi,

I have seen in the FopServlet example how to embed the FOP in the servlet.
But the problem is that XSLTInputHandler been used in renderXML method only
takes xml file and xsl file. How can I set up FOP to render a in-memory DOM
object with a specified xsl file to PDF without having to write the DOM out
to a temporary disk file?

Thanks,
___
Jianbo Mao
CheckFree i-Solutions
Email: [EMAIL PROTECTED]
Office:  +44 (0) 1753 567896
Mobile: +44 (0) 7810 483974
Fax:  +44 (0) 1753 567897
___