Re: Printing PDF with background image
Jeremias Maerki wrote: On 18.02.2005 11:18:21 Chris Bowditch wrote: Java 1.5, also has support for printing PDFs. Although other users on this list have reported problems rendering XSL-FO using FOP on JDK 1.5 Others may know of other tools that can be used to print a PDF That Java 1.5 has PDF printing support is only a rumour, I'm afraid. I've heard that myself and went looking for it. Found nothing. Some of the packages found following the link above claim to support a JPS (Java Printing System) plug-in that allows to print PDF, however. D'oh! You are right. I saw someone post some code a while ago and just assumed it would work on 1.5, I never actually tried it. JPS allows to print arbitrary objects, although each print service only supports a certain subset of DocFlavors. See the attached jdk15JPSEnum.txt which is a log of the JPSEnum.java I've also attached. It shows what JPS printing services (streaming and non-streaming) are available on my system under JDK 1.5. BTW, JPS is included in JDK 1.4! Yes I know JPS is available on 1.4, I just thought the PDF print service had been provided in 1.5. snip/ Further down you can see the streaming print services. JDK 1.4 and 1.5 support generation of PostScript files. Sun created a Graphics2D subclass which allows that. Similar to FOP's PSGraphics2D. Speaking of which: Just below that entry you can see two print services that I wrote as a proof of concept which add PDF and PS output support to JPS by delegating to FOP's PSGraphics2D and PDFGraphics2D. This would allow any Java application to generate PDF files via JPS with FOP. Thanks for the info/code, Jeremias. Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Printing PDF with background image
Forgot to attach the files... Jeremias Maerki jdk15JPSEnum.txt Description: Binary data JPSEnum.java Description: Binary data - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Printing PDF with background image
On 18.02.2005 11:18:21 Chris Bowditch wrote: Neil Guinto wrote: Jeremias, Thanks for taking the interest. Ok I'm looking for a quick solution at this point without me going into the nitty gritty of implementing a method (crunch time :-( ). I've got the actual PDF's rendered somewhere on the server side and wanted to route it straight to a network printer. Please advise. If you havent got time to change FOP's source code as Jeremias suggested then you are going to need a tool that will print a PDF for you. FOP cant help except by using the AWTRenderer-which as youve already found out has missing functionality. One tool that can print PDFs is Adobe Server, which is expensive. I seem to recall you used to be able to make command line calls to the Acrobat Reader to print a PDF, but I thought Adobe dropped this feature in later releases. You can also use GhostScript, for example. Or clicking the following link gives you several pointers to Java packages which support PDF printing: http://www.jguru.com/faq/view.jsp?EID=959950 (Note: I haven't worked with any of them. I'm just giving the links I found googling) Java 1.5, also has support for printing PDFs. Although other users on this list have reported problems rendering XSL-FO using FOP on JDK 1.5 Others may know of other tools that can be used to print a PDF That Java 1.5 has PDF printing support is only a rumour, I'm afraid. I've heard that myself and went looking for it. Found nothing. Some of the packages found following the link above claim to support a JPS (Java Printing System) plug-in that allows to print PDF, however. JPS allows to print arbitrary objects, although each print service only supports a certain subset of DocFlavors. See the attached jdk15JPSEnum.txt which is a log of the JPSEnum.java I've also attached. It shows what JPS printing services (streaming and non-streaming) are available on my system under JDK 1.5. BTW, JPS is included in JDK 1.4! You can see, for example, that my GhostScript PDF Writer printer driver supports several DocFlavors. I'm able print JPEG images coming from an URL or I could simply pipe a PostScript file through to create a PDF (distilling with GhostScript) or I can pass in a Printable object (for example FOP's AWT renderer). If JDK 1.5 supported PDF printing (i.e. not generating PDF through GhostScript like in this example), you'd see a DocFlavor for application/pdf similar to the one for application/postscript. You can also see that my Brother HL-1250 (a PCL laser printer) doesn't support application/postscript. Just to emphasize that different services have different capabilities. Further down you can see the streaming print services. JDK 1.4 and 1.5 support generation of PostScript files. Sun created a Graphics2D subclass which allows that. Similar to FOP's PSGraphics2D. Speaking of which: Just below that entry you can see two print services that I wrote as a proof of concept which add PDF and PS output support to JPS by delegating to FOP's PSGraphics2D and PDFGraphics2D. This would allow any Java application to generate PDF files via JPS with FOP. Jeremias Maerki - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Printing PDF with background image
Neil Guinto wrote: Jeremias, Thanks for taking the interest. Ok I'm looking for a quick solution at this point without me going into the nitty gritty of implementing a method (crunch time :-( ). I've got the actual PDF's rendered somewhere on the server side and wanted to route it straight to a network printer. Please advise. If you havent got time to change FOP's source code as Jeremias suggested then you are going to need a tool that will print a PDF for you. FOP cant help except by using the AWTRenderer-which as youve already found out has missing functionality. One tool that can print PDFs is Adobe Server, which is expensive. I seem to recall you used to be able to make command line calls to the Acrobat Reader to print a PDF, but I thought Adobe dropped this feature in later releases. Java 1.5, also has support for printing PDFs. Although other users on this list have reported problems rendering XSL-FO using FOP on JDK 1.5 Others may know of other tools that can be used to print a PDF Chris snip/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Printing PDF with background image
You're not printing PDFs if you use the AWTRenderer, strictly speaking. The formatted document is painted on a Graphics2D object. The problem you have, as you guessed, lies within AWTRenderer which does not implement drawImageClipped and drawImageScaled. If you implement these methods the background images will appear. On 17.02.2005 01:04:16 Neil Guinto wrote: I wanted to print a PDF that contains a background image. The print process needs no user intervention. The example outlined in FopPrintServlet could not render the image, I'm guessing because of AWTRenderer?. Is there anyway I could do accomplish what I want? FYI. The same PDF with no background image prints without any problem. Jeremias Maerki - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Printing PDF with background image
Jeremias, Thanks for taking the interest. Ok I'm looking for a quick solution at this point without me going into the nitty gritty of implementing a method (crunch time :-( ). I've got the actual PDF's rendered somewhere on the server side and wanted to route it straight to a network printer. Please advise. Jeremias Maerki wrote: You're not printing PDFs if you use the AWTRenderer, strictly speaking. The formatted document is painted on a Graphics2D object. The problem you have, as you guessed, lies within AWTRenderer which does not implement drawImageClipped and drawImageScaled. If you implement these methods the background images will appear. On 17.02.2005 01:04:16 Neil Guinto wrote: I wanted to print a PDF that contains a background image. The print process needs no user intervention. The example outlined in FopPrintServlet could not render the image, I'm guessing because of AWTRenderer?. Is there anyway I could do accomplish what I want? FYI. The same PDF with no background image prints without any problem. Jeremias Maerki - 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]