Your output is actually correct and your servlet is doing the right thing. Microsoft IE does not recognize the content as a PDF file and therefore does not invoke Acrobat to display the content, rather it simply dumps your PDF data as text to the browser window. What IE needs is an actual â.pdfâ at the end of the URL used to invoke your servlet. That is how it knows to render the output using Acrobat. The suggestion Adam made was to append &dummy.pdf to the end of the URL used to invoke your serlvet (not to append it to your response output stream). This is exactly what I have to do, since I am also generating PDF in memory and returning it to an IE browser.

 

Hope this helps.

-Steve

 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Friday, April 25, 2003 2:47 PM
To: [EMAIL PROTECTED]
Subject: RE: Help: Output from servlet is garbage

 


Thanks for the super fast reponse.
I'm using the following code to write the rendered stream to the response. I don't think I can just append the &dummy.pdf to the prepared stream, as it will will likely have an eof marker.
I was not able to find anything in the apache/xml docs and nothing wholly relevant in the archives. I may be a bit lame today (among other days). I would really appreciate it if you or someone else could help me further in this.
As a note, I had this working at one point. I made some big changes and then this started happening. I then went and removed the changes and now the problem persists. Hmmm.

a) Can you/anyone suggest how this could be done
b) Can you point to where to look on the "dummy.pdf" problem

Thanks again....Joe

<CODE-SNIPPET>
                        Reader reader = new java.io.StringReader(strBuffer1.toString());
                        InputSource foDoc = new InputSource(reader);

                        response.setContentType("application/pdf");

                        XMLReaderFactory.createXMLReader();
                        System.setProperty(
                                "org.xml.sax.driver",
                                "org.apache.xerces.parsers.SAXParser");

                        ByteArrayOutputStream baos = new ByteArrayOutputStream();                        
                        org.apache.fop.apps.Driver driver2 =
                                new org.apache.fop.apps.Driver(foDoc, baos);

                        String version = org.apache.fop.apps.Version.getVersion();
                        driver2.setRenderer("org.apache.fop.render.pdf.PDFRenderer");

                        driver2.addElementMapping(
                                "org.apache.fop.fo.StandardElementMapping");
                        driver2.addElementMapping("org.apache.fop.svg.SVGElementMapping");

                        XMLReader parser = createParser();
                        parser.setFeature(
                                "http://xml.org/sax/features/namespace-prefixes",
                                true);

                        driver2.run();

                        byte[] content = baos.toByteArray();
                        response.setContentLength(content.length);
                        response.getOutputStream().write(content);
//THIS WILL NOT WORK EVEN IF I FIX content.length -->
//        response.getOutputStream().write("&dummy.pdf".getBytes());

</CODE-SNIPPET>



 

"Adam Shelley" <[EMAIL PROTECTED]>

04/25/2003 04:45 PM
Please respond to fop-user

       
        To:        <[EMAIL PROTECTED]>
        cc:        
        Subject:        RE: Help: Output from servlet is garbage




The giberish is your pdf in binary format.  if you are using ie add
&dummy.pdf onto the end to ensure it will open it in the acrobat plugin.
Check the docs regarding this.

-Adam

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: April 25, 2003 1:40 PM
To: [EMAIL PROTECTED]
Subject: Help: Output from servlet is garbage




FOP version: fop-0.20.3
Platform: Win2K
WebSphere V5.0
J2EE Version: 1.3

I am getting following gibberish as a result of parsing the tollowing fo:
document. Apologies if this is too much too ask here.

I am also getting the following messages, but I think these are only page
size issues that shouldn't cause this result.

<GIBBERISH EXTRACT>
%PDF-1.3 %?ÂÂÂ 4 0 obj << /Type /Info /Producer (null) >> endobj 5 0 obj
<< /Length 1581 /Filter /FlateDecode >> stream x???Ks?HF??Z?"?????(??2?xL ?
(`? "I2 ?=WÂn<??Â7"???????mY?a?'Â"Â??/?B"?(U Âjc+MHM?ÂdM??O???
Â?2}??ÂÂ2q?'+^QZ ???/ ? Â??N? 4|*Â?o?_?Âw?Â???????????????????f?
|?Â????????'W?ÂS-?b*'V? nDmÂ??O?????Âf"U"?LF??<)??t Ak??T|??????Ââ??}
xq????????"Zi#8f"&?ZBÂ?qS3u d?ÂÂ??
</GIBBERISH EXTRACT>

XML FO DOC follows:

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
        <fo:layout-master-set>
                <fo:simple-page-master master-name="first" page-height
="21cm" page-width="29.7cm" margin-top="1cm" margin-bottom="2cm"
margin-left="2.5cm" margin-right="2.5cm">
                        <fo:region-body margin-top="3cm" />
                        <fo:region-before extent="3cm" />
                        <fo:region-after extent="1.5cm" />
                </fo:simple-page-master>
        </fo:layout-master-set>
        <fo:page-sequence master-reference="first">
                <fo:flow flow-name="xsl-region-body">
                        <fo:block font-size="11pt" font-family="sans-serif"
font-weight="bold" text-align="left" border-top-width="5px"
border-top-style="solid" border-top-color="blue" border-bottom-width="5px"
border-bottom-style="solid" border-bottom-color="blue" space-after.optimum
="10pt">Monthly Histogram for null null</fo:block>
                        <fo:table border-collapse="separate">
                                <fo:table-column column-width="36mm" />
                                <fo:table-column column-width="4mm" />
                                <fo:table-column column-width="61mm" />
                                <fo:table-column column-width="4mm" />
                                <fo:table-column column-width="61mm" />
                                <fo:table-column column-width="4mm" />
                                <fo:table-column column-width="83mm" />
                                <fo:table-column column-width="83mm" />
                                <fo:table-body>
                                        <fo:table-row>
                                                <fo:table-cell border-width
="0.0mm" border-style="solid" background-color="white">
                                                        <fo:table
border-collapse="separate">

<fo:table-column column-width="35mm" />

<fo:table-body font-size="8pt" font-family="sans-serif">

<fo:table-row font-size="10pt" font-family="sans-serif">
<fo:table-cell background-color="aqua">
<fo:block text-align="center">Applications/Systems</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell background-color="lightblue">
<fo:block text-align="center">MONTH</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell background-color="blue">
<fo:block color="white" text-align="center">WEEK</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>1633 ARCSERVE BACKUP</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>4 CC ARCSERVE BKP</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>AAMS/IPTS/IRMIS</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>ACBS</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>ACBS-ALPHA</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>ARMS</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>CALL REPORT (MARK TO MKT)</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>CARS</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>CASSETT</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>CDB</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>CFAS</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>CHECK PROCESSOR</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>CHINA EXIMBILLS</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>CIF</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>CIT NOTES</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">

<fo:block>CLASSIC LEASE</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>CLO</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>COMMERCIAL PAPER PRICING</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>COMPAQ NT SERVER</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>CTDS</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>CTS - MOS</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>DEALSCAN</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>DEVON</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>DREAMS DOWNLOAD SERVER</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>ECS</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>FIREWALL</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>FXNET</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>GATEWAY</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>GBASE</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>GCUST</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>GSM</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>HOMEGROWN</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>IDOM</fo:block>
</fo:table-cell>

</fo:table-row>


<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>INFINITY</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>INFOLEASE</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>INTELLISTOR (ACBS)</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>ITECS</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>JOURNYX (TIMEKEEPING)</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>MARKET ARTS</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>MARKET DATA UPLOAD</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>MATCH</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>METRO</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>MICROBANK</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>MTS</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>MTS (RGW)</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>MUREX</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>NACHA-EPM</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>NEON</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>NJ_NOVELL_SERVER</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>NJ_NT_SERVER</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">

<fo:block>NMOS DB/FIRM RISK</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>NMOS FRONT END</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>NMOS OBERON</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>NOTES_SERVER</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>NYTECH</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>NY_NOVELL_SERVER</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>OBS</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>OBSS</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>PANAGON</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>PDC/BDC/WINS/DHCP/RAS</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>PEREGRINE</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>PROD NY NOTES</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>REALTIME RATE SERVER</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>SECLEN</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>SERVICE CHARGE</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>SOLOMON</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>SUNGARD INTELLI-SUITE</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>TELEX (LHA AND PASSPORT)</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>THOMSON OFAC (IF)</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>TRAM</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>URBIS</fo:block>
</fo:table-cell>

</fo:table-row>

<fo:table-row>
<fo:table-cell border-width="0.175mm" border-style="solid" background-color
="white">
<fo:block>WEBSENSE</fo:block>
</fo:table-cell>

</fo:table-row>

</fo:table-body>
                                                        </fo:table>
                                                </fo:table-cell>
                                        </fo:table-row>
                                </fo:table-body>
                        </fo:table>
                </fo:flow>
        </fo:page-sequence>
</fo:root>





= = = = = = = = = == = = = = = == = = = = = = = == = = = = = == = = = = This
transmittal and any attachments may contain confidential, privileged or
sensitive information and is solely for the use of the intended recipient.
If you are not intended recipient, you are hereby notified that you have
received this transmittal and any such attachments in error and any review,
dissemination, distribution or copying thereof is strictly prohibited. If
you have received this transmittal and any attachments in error please
notify the sender and immediately destroy the message and all its
attachments. Any opinions herein expressed may be those of the author and
not necessarily of Mizuho Corporate Bank, Ltd (the "Bank"). The Bank accepts
no responsibility for the accuracy or completeness of any information herein
contained.
= = = = = = = = = == = = = = = == = = = = = = = == = = = = = == = = = =

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to