RE: FOP embedding
Can you please be more specific. Do you want to use FOP in a servlet to produce a PDF from dynamically created XML and return the PDF to the browser to display? Are you having problems writing the Java code to do this, or are you having problems with FOP not working? Jim -Original Message- From: Carlos Daniel Schafer [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 06, 2002 9:34 AM To: [EMAIL PROTECTED] Subject: FOP embedding Hi! I saw those examples the FOP I have problem with transformer XML to PDF from a servlet. How I to do? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: FOP embedding
I'm sorry Do you want to use FOP in a servlet to produce a PDF from dynamically created XML and return the PDF to the browser to display? Yes I have this files (FOP). I have code this servlet with created XML and I desidere dynamically return the PDF. Do you want send this servlet for look? -Mensaje original- De: Jim Urban [SMTP:[EMAIL PROTECTED]] Enviado el: miércoles, 06 de marzo de 2002 13:05 Para: [EMAIL PROTECTED] Asunto: RE: FOP embedding Can you please be more specific. Do you want to use FOP in a servlet to produce a PDF from dynamically created XML and return the PDF to the browser to display? Are you having problems writing the Java code to do this, or are you having problems with FOP not working? Jim -Original Message- From: Carlos Daniel Schafer [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 06, 2002 9:34 AM To: [EMAIL PROTECTED] Subject: FOP embedding Hi! I saw those examples the FOP I have problem with transformer XML to PDF from a servlet. How I to do? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: FOP embedding
public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException { ... your code try { String xmlString = new String(); // your xml TransformerFactory tFactory = TransformerFactory.newInstance(); File foFile= new File(foXslFile.xsl); Source foXslSource = new StreamSource(foFile); Transformer pdfTransformer = tFactory.newTransformer(foXslSource); Writer out = new StringWriter(); Source xmlSource = new StreamSource(new StringReader(xmlString)); pdfTransformer.transform(xmlSource, new StreamResult(out)); out.close(); String fopstring = out.toString(); InputSource foSource = new InputSource(new StringReader(fopstring)); renderFO(foSource, req, res, inPdf); ByteArrayOutputStream baout = new ByteArrayOutputStream(); Driver driver = new Driver(foSource , baout); res.setContentType(application/pdf); driver.setRenderer(Driver.RENDER_PDF); driver.run(); byte[] content = baout.toByteArray(); res.setContentLength(content.length); // This keeps IE happy res.getOutputStream().write(content); res.getOutputStream().flush(); res.flushBuffer(); } catch (Exception e) { System.err.println(Exception in init: + e.toString()); e.printStackTrace(); } ... more code } -Original Message- From: Carlos Daniel Schafer [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 06, 2002 10:28 AM To: [EMAIL PROTECTED] Subject: RE: FOP embedding I'm sorry Do you want to use FOP in a servlet to produce a PDF from dynamically created XML and return the PDF to the browser to display? Yes I have this files (FOP). I have code this servlet with created XML and I desidere dynamically return the PDF. Do you want send this servlet for look? -Mensaje original- De: Jim Urban [SMTP:[EMAIL PROTECTED]] Enviado el: miércoles, 06 de marzo de 2002 13:05 Para: [EMAIL PROTECTED] Asunto: RE: FOP embedding Can you please be more specific. Do you want to use FOP in a servlet to produce a PDF from dynamically created XML and return the PDF to the browser to display? Are you having problems writing the Java code to do this, or are you having problems with FOP not working? Jim -Original Message- From: Carlos Daniel Schafer [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 06, 2002 9:34 AM To: [EMAIL PROTECTED] Subject: FOP embedding Hi! I saw those examples the FOP I have problem with transformer XML to PDF from a servlet. How I to do? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: FOP embedding
Jim Are your file foXslFile.xsl have code fo:...? -Mensaje original- De: Jim Urban [SMTP:[EMAIL PROTECTED]] Enviado el: miércoles, 06 de marzo de 2002 13:52 Para: [EMAIL PROTECTED] Asunto: RE: FOP embedding public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException { ... your code try { String xmlString = new String(); // your xml TransformerFactory tFactory = TransformerFactory.newInstance(); File foFile= new File(foXslFile.xsl); Source foXslSource = new StreamSource(foFile); Transformer pdfTransformer = tFactory.newTransformer(foXslSource); Writer out = new StringWriter(); Source xmlSource = new StreamSource(new StringReader(xmlString)); pdfTransformer.transform(xmlSource, new StreamResult(out)); out.close(); String fopstring = out.toString(); InputSource foSource = new InputSource(new StringReader(fopstring)); renderFO(foSource, req, res, inPdf); ByteArrayOutputStream baout = new ByteArrayOutputStream(); Driver driver = new Driver(foSource , baout); res.setContentType(application/pdf); driver.setRenderer(Driver.RENDER_PDF); driver.run(); byte[] content = baout.toByteArray(); res.setContentLength(content.length); // This keeps IE happy res.getOutputStream().write(content); res.getOutputStream().flush(); res.flushBuffer(); } catch (Exception e) { System.err.println(Exception in init: + e.toString()); e.printStackTrace(); } ... more code } -Original Message- From: Carlos Daniel Schafer [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 06, 2002 10:28 AM To: [EMAIL PROTECTED] Subject: RE: FOP embedding I'm sorry Do you want to use FOP in a servlet to produce a PDF from dynamically created XML and return the PDF to the browser to display? Yes I have this files (FOP). I have code this servlet with created XML and I desidere dynamically return the PDF. Do you want send this servlet for look? -Mensaje original- De: Jim Urban [SMTP:[EMAIL PROTECTED]] Enviado el: miércoles, 06 de marzo de 2002 13:05 Para: [EMAIL PROTECTED] Asunto: RE: FOP embedding Can you please be more specific. Do you want to use FOP in a servlet to produce a PDF from dynamically created XML and return the PDF to the browser to display? Are you having problems writing the Java code to do this, or are you having problems with FOP not working? Jim -Original Message- From: Carlos Daniel Schafer [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 06, 2002 9:34 AM To: [EMAIL PROTECTED] Subject: FOP embedding Hi! I saw those examples the FOP I have problem with transformer XML to PDF from a servlet. How I to do? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: FOP embedding
So, I have the problem (Huston). I take my code (xsl) and rewriter in fo:. for all those lines. -Mensaje original- De: Jim Urban [SMTP:[EMAIL PROTECTED]] Enviado el: miércoles, 06 de marzo de 2002 15:57 Para: [EMAIL PROTECTED] Asunto: RE: FOP embedding Yes. Here is the beginning of one of our xsl files: ?xml version='1.0'? xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform; xmlns:fo=http://www.w3.org/1999/XSL/Format; xsl:template match=/ fo:root fo:layout-master-set fo:simple-page-master master-name=first page-height=8.5in page-width=11in margin-top=.25in margin-bottom=.25in margin-left=.25in margin-right=.25in fo:region-before extent=.5in / fo:region-body margin-top=.5in margin-bottom=.5in / fo:region-after extent=.5in / /fo:simple-page-master /fo:layout-master-set Jim -Original Message- From: Carlos Daniel Schafer [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 06, 2002 12:33 PM To: [EMAIL PROTECTED] Subject: RE: FOP embedding Jim Are your file foXslFile.xsl have code fo:...? -Mensaje original- De: Jim Urban [SMTP:[EMAIL PROTECTED]] Enviado el: miércoles, 06 de marzo de 2002 13:52 Para: [EMAIL PROTECTED] Asunto: RE: FOP embedding public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException { ... your code try { String xmlString = new String(); // your xml TransformerFactory tFactory = TransformerFactory.newInstance(); File foFile= new File(foXslFile.xsl); Source foXslSource = new StreamSource(foFile); Transformer pdfTransformer = tFactory.newTransformer(foXslSource); Writer out = new StringWriter(); Source xmlSource = new StreamSource(new StringReader(xmlString)); pdfTransformer.transform(xmlSource, new StreamResult(out)); out.close(); String fopstring = out.toString(); InputSource foSource = new InputSource(new StringReader(fopstring)); renderFO(foSource, req, res, inPdf); ByteArrayOutputStream baout = new ByteArrayOutputStream(); Driver driver = new Driver(foSource , baout); res.setContentType(application/pdf); driver.setRenderer(Driver.RENDER_PDF); driver.run(); byte[] content = baout.toByteArray(); res.setContentLength(content.length); // This keeps IE happy res.getOutputStream().write(content); res.getOutputStream().flush(); res.flushBuffer(); } catch (Exception e) { System.err.println(Exception in init: + e.toString()); e.printStackTrace(); } ... more code } -Original Message- From: Carlos Daniel Schafer [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 06, 2002 10:28 AM To: [EMAIL PROTECTED] Subject: RE: FOP embedding I'm sorry Do you want to use FOP in a servlet to produce a PDF from dynamically created XML and return the PDF to the browser to display? Yes I have this files (FOP). I have code this servlet with created XML and I desidere dynamically return the PDF. Do you want send this servlet for look? -Mensaje original- De: Jim Urban [SMTP:[EMAIL PROTECTED]] Enviado el: miércoles, 06 de marzo de 2002 13:05 Para: [EMAIL PROTECTED] Asunto: RE: FOP embedding Can you please be more specific. Do you want to use FOP in a servlet to produce a PDF from dynamically created XML and return the PDF to the browser to display? Are you having problems writing the Java code to do this, or are you having problems with FOP not working? Jim -Original Message- From: Carlos Daniel Schafer [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 06, 2002 9:34 AM To: [EMAIL PROTECTED] Subject: FOP embedding Hi! I saw those examples the FOP I have problem with transformer XML to PDF from a servlet. How I to do? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED