>
> Hi Team,
>
> Following is the code that i am using for generating PDF
> Content using FOP of Apache.
> When i have deployed this code on Windows machine and running from
> the
> same machine, i am getting a prompt whether to Open the PDF or Save
> the
> PDF (General Windows Feature........). Both Opening the PDF file at
> the
> current location and Saving the file to Local hard disk are working
> fine.
> But when i deployed the same code on Unix machine, and running it
> from
> Windows machine, again i am getting prompt for "OPEN / SAVE" . This
> time
> saving the file to local disk is working fine but i am unable to open
> the
> file in the current location for viewing. It is giving " File can not
> be
> opened " error. Is it the problem related to Operating System or can
>
> anything be done through code ? Please help me out.
>
>
>
>
>
> xslSourceName="newged.XSL";
> String xslPath = "";
> Source xmlSource = new
> StreamSource(new
> StringReader(xmlData));
> Source xslSource = new
> StreamSource(request.getSession().getServletContext
().getResourceAsStream("/xsl/"+xslSourceName));
>
>
> request.getSession(false).getServletContext().getResourceAsStream
("/WEB-INF/"+xslSourceName));
>
> // Render with FOP
> ByteArrayOutputStream out = new
> ByteArrayOutputStream();
> Driver driver = new Driver();
>
> driver.setRenderer(Driver.RENDER_PDF);
> driver.setOutputStream(out);
>
> // Do the transform and PDF rendering
>
> directly to the destination output stream.
> Result result = new
> StreamResult(out);
> TransformerFactory tf =
> TransformerFactory.newInstance();
>
> Transformer transformer =
> tf.newTransformer(xslSource);
>
> transformer.transform(xmlSource, new
> SAXResult(driver.getContentHandler()));
> byte[] content =
> out.toByteArray();
>
>
> response.setContentLength(content.length);
>
> response.getOutputStream().write(content);
> response.getOutputStream().flush();
>
>
> Thanks in Advance,
> Rajasekhar Cherukuri
Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you |