[prev in list] [next in list] [prev in thread] [next in thread]
List: fop-user
Subject: Strange problem
From: rajasekhar.cherukuri () tcs ! com
Date: 2005-05-18 7:33:52
Message-ID: OFE9DEF497.CAF599E9-ON65257005.0028594C-65257005.00287C21 () tcs ! com
[Download RAW message or body]
--=_alternative 00287BF965257005_=
Content-Type: text/plain; charset="US-ASCII"
>
> 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
--=_alternative 00287BF965257005_=
Content-Type: text/html; charset="US-ASCII"
<br><font size=2><tt>> <br>
> Hi Team,<br>
> <br>
> Following is the code that i am using
for generating PDF<br>
> Content using FOP of Apache. <br>
> When i have deployed this code on Windows machine and running from<br>
> the <br>
> same machine, i am getting a prompt whether to Open the PDF or Save<br>
> the <br>
> PDF (General Windows Feature........). Both Opening the PDF file at<br>
> the <br>
> current location and Saving the file to Local hard disk are working<br>
> fine. <br>
> But when i deployed the same code on Unix machine, and running it<br>
> from <br>
> Windows machine, again i am getting prompt for "OPEN / SAVE"
. This<br>
> time <br>
> saving the file to local disk is working fine but i am unable to open<br>
> the <br>
> file in the current location for viewing. It is giving " File
can not<br>
> be <br>
> opened " error. Is it the problem related to Operating System
or can<br>
> <br>
> anything be done through code ? Please help me out.<br>
> <br>
> <br>
> <br>
> <br>
> <br>
>
xslSourceName="newged.XSL"; <br>
>
String xslPath = "";<br>
>
Source xmlSource = new<br>
> StreamSource(new <br>
> StringReader(xmlData));<br>
>
Source xslSource = new
<br>
> StreamSource(request.getSession().getServletContext<br>
().getResourceAsStream("/xsl/"+xslSourceName));<br>
> <br>
> <br>
> request.getSession(false).getServletContext().getResourceAsStream<br>
("/WEB-INF/"+xslSourceName));<br>
> <br>
>
// Render with FOP<br>
>
ByteArrayOutputStream out = new <br>
> ByteArrayOutputStream();<br>
>
Driver driver = new Driver();<br>
>
<br>
> driver.setRenderer(Driver.RENDER_PDF);<br>
>
driver.setOutputStream(out);<br>
> <br>
>
// Do the transform and PDF rendering<br>
> <br>
> directly to the destination output stream.<br>
>
Result result = new<br>
> StreamResult(out);<br>
>
TransformerFactory tf = <br>
> TransformerFactory.newInstance();<br>
> <br>
>
Transformer
transformer = <br>
> tf.newTransformer(xslSource); <br>
>
<br>
> transformer.transform(xmlSource, new <br>
> SAXResult(driver.getContentHandler()));<br>
>
byte[]
content =<br>
> out.toByteArray();<br>
> <br>
>
<br>
> response.setContentLength(content.length);<br>
>
<br>
> response.getOutputStream().write(content);<br>
>
response.getOutputStream().flush();<br>
> <br>
> <br>
> Thanks in Advance,<br>
> Rajasekhar Cherukuri</tt></font>
<table><tr><td bgcolor=#ffffff><font color=#000000>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<br> </font></td></tr></table>
--=_alternative 00287BF965257005_=--
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic