Thanks it worked for me too now both in Netscape and
IE. However what if I wanted to embed to PDF results from
FOP inside some HTML code for formatting
purposes?, is that possible at all. What I mean is
is possible to send the PDF and the HTML back to
the client in some fashion?
Greetings,
Carmelo
----- Original Message -----
From: "Matt Savino" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, September 26, 2001 7:20 PM
Subject: Re: Anything wrong with this code (please look at attachements)
> For one thing it looks like you are mixing PDF and HTML content in your
> response:
>
> ServletOutputStream out = response.getOutputStream();
> try {
> out.println("<HTML>\n");
> out.println("<HEAD>\n");
> out.println("<BODY>\n");
> out.println("<CENTER><H1>FOP and PDF
> Creation.</H1></CENTER>\n");
> renderFO(response);
> out.println("</BODY>\n");
> out.println("</HTML>\n");
> }
> and
>
> byte[] content = outPDF.toByteArray();
> response.setContentLength(content.length);
> response.getOutputStream().write(content);
> response.getOutputStream().println("<BR><BR>");
> response.getOutputStream().println("There should be a PDF
> image above");
> response.flushBuffer();
> response.getOutputStream().flush();
>
> For some reason, Netscape doesn't mind this. But IE seems to create an
> Http error that's related to the discrepancy in the content length of
> the response. (At least with Weblogic). I removed all your
> out.println("..") calls and the code works.
>
> Also I have noticed a weird bug where IE sometimes doesn't recognize
> PDF, even though you set the response type to "application/pdf". I was
> using the FopServlet example from .20.1. It worked fine if used
> Netscape. The weird thing is if I clicked back, then forward in IE, it
> recognized the PDF and loaded the plugin. I think I solved the problem
> by mapping the servlet URI to FopServletTest.pdf and sending the FO
> filename as a POST form instead of a GET.
>
> Hope this helps,
> Matt
>
> > Carmelo Montanez wrote:
> >
> > Hello all
> >
> > Thanks Sempri for all your comments. For anyone interested, I am
> > attaching a very
> > slimed down copy of my Servlet. I am hardwiring the file name (FO
> > file) inside the
> > servlet (for convenience of running). I am also attaching a "dummy"
> > HTML file
> > to call the servlet (no parameters are retrieved from the HTML by the
> > servlet).
> > I am also attaching the FO file
> >
> > I am running this using Tomcat. If anyone please try an attempt to
> > run the
> > servlet. I am still getting "stuff" (as you will see) on
> > the browser. Please look
> > at the "import" statements (most of them are comments) to see
> > which classes you need, I can can provide them if need be.
> >
> > I am using FOP's latest version.
> >
> > Greetings,
> > Carmelo
> >
> > Name: testPDF.java
> > testPDF.java Type: unspecified type (application/octet-stream)
> > Encoding: quoted-printable
> >
> > Name: test.html
> > test.html Type: Hypertext Markup Language (text/html)
> > Encoding: 7bit
> >
> > Name: cbpbp-background-color4.fo
> > cbpbp-background-color4.fo Type: unspecified type
> > (application/octet-stream)
> > Encoding: quoted-printable
> >
> > ---------------------------------------------------------------
> > ---------------------------------------------------------------------
> > 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]