RE: How to fix image degradation in FOP-generated PDF
I am using SVGs for all images. That was the only way that I could ensure print quality images with no dithering. For example the documents that I am generating contain a lot of pie charts, and these circles look great when using SVG but JPEG and PNG just didn't cut it. Steve Albin -Original Message- From: Tom Peters [mailto:[EMAIL PROTECTED] On Behalf Of A.R. (Tom) Peters Sent: Thursday, January 13, 2005 1:40 PM To: [EMAIL PROTECTED] Subject: Re: How to fix image degradation in FOP-generated PDF On Wed, 12 Jan 2005, Smilgiewicz, Gene [CPB] wrote: Using fop-0.20.5 on a Sun/Solaris box, I am able to generate a PDF containing graphics referenced by the fo:external-graphic tag. The PDF gets generated (sloowly) but the GIF and JPG images look dithered, not nearly as sharp a the source images. Images degrade when they are the exact size of the rendered output and when they are scaled down, whether height/width are specified or not. My group has double and triple checked that we are using all relevant attributes (for example: fo:external-graphic content-type=image/gif content-width=80px content-height=30px src=/default/main/Intranet/MST/WORKAREA/MST/graphics/logo_pop.gif/ ). We've double and triple-checked the image files to be sure that the images are sharp (they are). Can anyone suggest something we have overlooked that may be causing the image degradation? THANKS! I get similar situations depending on how I process. Using fop to generate a PDF (default) from a .fo file works for JPEG. Using fop to generate a PS file from a .fo file works too. Using ghostscript (gs) to rework the first PDF file to a PDF file makes the image chunky. Using ps2pdf to change the PS file to PDF makes the image chunky. Maybe not directly relevant to your situation, but I suggest to look if generating PS makes something printable with the proper resolution. -- #!$!%(@^%#%*(([EMAIL PROTECTED]@^$##*#@(%)@**$!(!^(#((#%!)%*@)($($$%(@#)*!^$ )[EMAIL PROTECTED]@) Tom Peters - 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]
Appending a PDF file to another PDF programmatically
I may need to append a PDF file (or several PDF files) to the end of a PDF that I create with FOP. I need to do this programmatically. The problem is that Im producing a PDF using FOP in a web application and I need to attach to the end of this generated PDF one or more existing (static) PDFs before returning the entire stream back to the browser. Can anyone help me with this one? Thank you, Steve Albin
Help with JAI, TIFF, and FOP
I am using the fop 0.20.4 binary distribution on Windows. I have a couple of questions Im hoping that others can help me with. 1) I am unable to get FOP to invoke JAI to handle a TIFF or PNG. I have copied the jai_core.jar and jai_codec.jar files to {fop-install-lib}\lib. Here is my FO: fo:external-graphic src=""> When I invoke FOP with the JAI libraries in the path I get the following error: [ERROR] Error while creating area : Error creating FopImage object (file:/C:/image.tiff) : Jimi image library not available Why would I get the Jimi image library not available if Im trying to use JAI? 2) I read through the thread on clarifications about using JAI/JIMI with FOP and it appears that those who successfully used JAI had to build FOP themselves. Does the binary distribution really support JAI as described or do I need to actually built FOP myself to support it? Also, should I be using a different version of FOP? 3) I cannot render a TIFF in a PDF with the JIMI library If I invoke FOP with the JIMI library in the path I get the following [ERROR] Error while creating area : Error while loading image file:/C:/image.tiff : class java.lang.Exception - Image error Any thoughts? Thank you in advance, Steve
font and embedding FOP question
I would like to use additional fonts with FOP, where FOP is embedded in a Servlet. The instructions at http://xml.apache.org/fop/fonts.html say to use the c conf/userconfig.xml option on the command line in order for FOP to find custom font information. However how do you specify this information when FOP is embedded (e.g. when using the FOP APIs)? Thanks, Steve
RE: Help: Output from servlet is garbage
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 againJoe 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 ?=Wn??7???mY?a?'??/?B?(U jc+MHM?dM??O??? ?2}??2q?'+^QZ ???/ ? ??N? 4|*?o?_?wf? |?'W?S-?b*'V? nDm??O?fU?LF??)??t Ak??T|} xqZi#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 /
RE: Help: Output from servlet is garbage
By the way, see the Note halfway down the page http://xml.apache.org/fop/embedding.htmlb under Using FOP in a Servlet Some versions of Internet Explorer will not automatically show the PDF. This is well-known to be a limitation of Internet Explorer, and is not a problem with the servlet. However, Internet Explorer can still be used to download the PDF so that it can be viewed later. Also, appending .pdf to the end of the URL may help. -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 againJoe 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 ?=Wn??7???mY?a?'??/?B?(U jc+MHM?dM??O??? ?2}??2q?'+^QZ ???/ ? ??N? 4|*?o?_?wf? |?'W?S-?b*'V? nDm??O?fU?LF??)??t Ak??T|} xqZi#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