Printing PDF with background image
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. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
URGENT - Adding dynamic, non file system images into a pdf docume nt.
Title: URGENT - Adding dynamic, non file system images into a pdf document. I'm trying to produce a pdf document that contains dynamically generated jpeg images. The images are available within the session. I'm using a cocoon pipline match to serialise xsl-fo into pdf documents. I've explored the following options: 1.) Creating a cocoon servlet to stream back the image data. This work fine for images within HTML document. When I reference the servlet from an xsl-fo image source, my session is unavailable and only a new session accessible. 2.) Create a cocoon generator to turn jpeg image binary into a base64 encoded string and embed this string within an instream-foreign-object using svg. This method produces visible images, but the final pdf document is huge. It's like the jpeg compression is being translated into an uncompressed bitmap. fo:instream-foreign-object content-type=content-type:image/jpeg svg:svg height=176mm width=277mm svg:image width=277mm height=176mm x=0 y=0 xlink:href="" /9j/4AAQSkZJRgABAQAAAQAgLCgoL . . . . / /svg:svg /fo:instream-foreign-object I've already spent too much time trying to get this working. I've found some references to this type of issue in other mail archives, but the responses I've seen have been very vague. I'll be forced to drop using pdf reports and use ugly html if I can't resolve this very soon. If anyone has a solution that they have tried, please let me know. I'd hate to abandon fop and produce nasty html reports after getting this far! Please help Craig.
Escape problem ?
I am generatingXML - which is having some unicodes and these r writen as amp;#x2206; (for #x2206; ) When irender pdf using xslit does not show me actual unicode character but shows me #x2206. I tried using disable-output-escaping="yes" inside xsl but no use. How can i get proper display in pdf ? regards Manisha Do you Yahoo!? Yahoo! Search presents - Jib Jab's 'Second Term'
fop -fo error
Hello all, When i run the command: /usr/bin/fop -fo users_guide.fo -ps users_guide.ps I get the following error message: Java HotSpot(TM) Client VM warning: Can't detect initial thread stack location - no /proc/self/stat [INFO] Using org.apache.xerces.parsers.SAXParser as SAX2 Parser [INFO] FOP 0.20.5 [INFO] Using org.apache.xerces.parsers.SAXParser as SAX2 Parser [INFO] building formatting object tree [INFO] setting up fonts [ERROR] property - background-position-horizontal is not implemented yet. [ERROR] property - background-position-vertical is not implemented yet. [INFO] JAI support was not installed (read: not present at build time). Trying to use Jimi instead Error creating background image: Error creating FopImage object (Error creating FopImage object (http://docbook.sourceforge.net/release/images/draft.png) : org.apache.fop.image.JimiImage [ERROR] property - background-position-horizontal is not implemented yet. [ERROR] property - background-position-vertical is not implemented yet. Error creating background image: Error creating FopImage object (Error creating FopImage object (http://docbook.sourceforge.net/release/images/draft.png) : org.apache.fop.image.JimiImage ***(Last message repeted around 20 more times)*** [ERROR] Unknown enumerated value for property 'relative-align': baseline [ERROR] Error in relative-align property value 'baseline': org.apache.fop.fo.expr.PropertyException: No conversion defined [ERROR] Unknown enumerated value for property 'relative-align': baseline [ERROR] Error in relative-align property value 'baseline': org.apache.fop.fo.expr.PropertyException: No conversion defined [ERROR] Unknown enumerated value for property 'relative-align': baseline [ERROR] Error in relative-align property value 'baseline': org.apache.fop.fo.expr.PropertyException: No conversion defined [ERROR] Unknown enumerated value for property 'relative-align': baseline ***(Last message repeated 50-60 times)*** [INFO] [1] [INFO] area contents overflows area in line [INFO] [2] [INFO] area contents overflows area in line [INFO] area contents overflows area in line [INFO] area contents overflows area in line [INFO] area contents overflows area in line [INFO] area contents overflows area in line [INFO] area contents overflows area in line [INFO] area contents overflows area in line [INFO] area contents overflows area in line [INFO] area contents overflows area in line [INFO] area contents overflows area in line [INFO] [3] [INFO] [4] [INFO] [5] [INFO] [6] [INFO] [7] [ERROR] Unknown enumerated value for property 'relative-align': baseline [ERROR] Error in relative-align property value 'baseline': org.apache.fop.fo.expr.PropertyException: No conversion defined [ERROR] Unknown enumerated value for property 'relative-align': baseline [ERROR] Error in relative-align property value 'baseline': org.apache.fop.fo.expr.PropertyException: No conversion defined [ERROR] Unknown enumerated value for property 'relative-align': baseline [ERROR] Error in relative-align property value 'baseline': org.apache.fop.fo.expr.PropertyException: No conversion defined [ERROR] Unknown enumerated value for property 'relative-align': baseline ***(message repeated 20 times)*** [INFO] area contents overflows area in line [INFO] area contents overflows area in line [INFO] area contents overflows area in line [INFO] area contents overflows area in line ***(message repeated around 40 times)*** [INFO] [12] [INFO] [13] [INFO] [14] [ERROR] file:users_guide.fo:611:1093 The id id2522584 already exists in this document Im using the FOP version: [INFO] Using org.apache.xerces.parsers.SAXParser as SAX2 Parser [INFO] FOP 0.20.5 Running on GNU/Linux x86. I have been looking for information about this , but i really don't find too much, I highly appreciate any help. Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Getting huge no of errors
I've never seen this but I guess they are warnings from a validating XML parser. Maybe you have a Schema declaration in your stylesheet or something like that. Maybe you should rewrite the servlet to use a more JAXP-like approach as described here: http://cvs.apache.org/viewcvs.cgi/xml-fop/examples/embedding/java/embedding/ExampleXML2PDF.java?hideattic=1rev=1.1.2.2only_with_tag=fop-0_20_2-maintainview=markup I don't know if this will help but you will have greater control over how the XSLT process is done. Good luck. On 16.02.2005 10:02:25 Manisha Sathe wrote: Till now i was trying fop through command line. I was passing xml and xsl file and getting pdf file. So far so good. Now i changed it to servlet. Using example servlet provided but i am getting huge number of errors. (although i am getting the o/p) - TraxInputHandler input = new TraxInputHandler(new File(xmlParam), new File(xslParam)); ByteArrayOutputStream out = new ByteArrayOutputStream(); Driver driver = new Driver(); driver.setLogger(log); driver.setRenderer(Driver.RENDER_PDF); driver.setOutputStream(out); input.run(driver); ,. later i write it to pdf file. But i get Errors like [Error] advertformat.xsl:7:37 Element type xsl:stylesheet must be declared [Error] advertformat.xsl:8:37 Element type xsl:template must be declared [Error] advertformat.xsl:10:37 Element type fo:table must be declared [Error] advertformat.xsl:17:37 Element type fo:table-row must be declared [Error] advertformat.xsl:17:37 Element type fo:table-cell must be declared . .. Like this for all tags it is giving me error. I am getting my pdf file properly but i am not understanding why this is happenning then ? Jeremias Maerki - 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: URGENT - Adding dynamic, non file system images into a pdf docume nt.
So my answer [1] didn't help? You could have said so earlier. What were your problems with my proposal? What you need just doesn't exist in FOP. The protocol handler is something that might be found somewhere else but can then be used inside of FOP. I've once started to write such a protocol handler but it's nowhere near finished. I'm sure this approach will work but it'll take some effort. [1] http://marc.theaimsgroup.com/?l=fop-userm=110810769119382w=2 On 17.02.2005 06:14:27 Burlock, Craig (SAPOL) wrote: I'm trying to produce a pdf document that contains dynamically generated jpeg images. The images are available within the session. I'm using a cocoon pipline match to serialise xsl-fo into pdf documents. I've explored the following options: 1.) Creating a cocoon servlet to stream back the image data. This work fine for images within HTML document. When I reference the servlet from an xsl-fo image source, my session is unavailable and only a new session accessible. 2.) Create a cocoon generator to turn jpeg image binary into a base64 encoded string and embed this string within an instream-foreign-object using svg. This method produces visible images, but the final pdf document is huge. It's like the jpeg compression is being translated into an uncompressed bitmap. fo:instream-foreign-object content-type=content-type:image/jpeg svg:svg height=176mm width=277mm svg:image width=277mm height=176mm x=0 y=0 xlink:href=data:image/jpeg;base64, /9j/4AAQSkZJRgABAQAAAQAgLCgoL . . . . / /svg:svg /fo:instream-foreign-object I've already spent too much time trying to get this working. I've found some references to this type of issue in other mail archives, but the responses I've seen have been very vague. I'll be forced to drop using pdf reports and use ugly html if I can't resolve this very soon. If anyone has a solution that they have tried, please let me know. I'd hate to abandon fop and produce nasty html reports after getting this far! Please help Craig. Jeremias Maerki - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Escape problem ?
You simply have to make sure that in the XML you generate you see @x2205; and not amp;#x2206;. Then it should work. Can't say more without seeing a code snippet showing how you generate this codes. On 17.02.2005 08:27:19 Manisha Sathe wrote: I am generating XML - which is having some unicodes and these r writen as amp;#x2206; (for #x2206; ) When i render pdf using xsl it does not show me actual unicode character but shows me #x2206. I tried using disable-output-escaping=yes inside xsl but no use. How can i get proper display in pdf ? Jeremias Maerki - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: fop -fo error
Sounds like another DocBook user in trouble. You will probably find some helpful pointers in the archives: http://marc.theaimsgroup.com/?l=fop-userw=2r=1s=docbook+already+existsq=b On 17.02.2005 08:30:27 Luis F. Araujo wrote: Hello all, When i run the command: /usr/bin/fop -fo users_guide.fo -ps users_guide.ps I get the following error message: snip/ [ERROR] file:users_guide.fo:611:1093 The id id2522584 already exists in this document Im using the FOP version: [INFO] Using org.apache.xerces.parsers.SAXParser as SAX2 Parser [INFO] FOP 0.20.5 Running on GNU/Linux x86. I have been looking for information about this , but i really don't find too much, I highly appreciate any help. Thanks. Jeremias Maerki - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Getting huge no of errors
Thanks Jeremias, I will try that out too. I am not getting warnings but [Error] advertformat.xsl:7:37 Element type "xsl:stylesheet" must be declared . like this for all tags inside xsl like fo:table, fo:row ... etc. i think as u mentioned am i passing wrong xsl file ? Would u mind passing me simplest xsl / xml files so that i can check with that. regards ManishaJeremias Maerki [EMAIL PROTECTED] wrote: I've never seen this but I guess they are warnings from a validating XMLparser. Maybe you have a Schema declaration in your stylesheet orsomething like that. Maybe you should rewrite the servlet to use a moreJAXP-like approach as described here:http://cvs.apache.org/viewcvs.cgi/xml-fop/examples/embedding/java/embedding/ExampleXML2PDF.java?hideattic=1rev=1.1.2.2>I don't know if this will help but you will have greater control overhow the XSLT process is done.Good luck.On 16.02.2005 10:02:25 Manisha Sathe wrote: Till now i was trying fop through command line. I was passing xml and xsl file and getting pdf file. So far so good. Now i changed it to servlet. Using example servlet provided but i am getting huge number of errors. (although i am getting the o/p) - TraxInputHandler input = new TraxInputHandler(new File(xmlParam), new File(xslParam)); ByteArrayOutputStream out = new ByteArrayOutputStream(); Driver driver = new Driver(); driver.setLogger(log); driver.setRenderer(Driver.RENDER_PDF); driver.setOutputStream(out); input.run(driver); ,. later i write it to pdf file. But i get Errors like [Error] advertformat.xsl:7:37 Element type "xsl:stylesheet" must be declared [Error] advertformat.xsl:8:37 Element type "xsl:template" must be declared [Error] advertformat.xsl:10:37 Element type "fo:table" must be declared [Error] advertformat.xsl:17:37 Element type "fo:table-row" must be declared [Error] advertformat.xsl:17:37 Element type "fo:table-cell" must be declared . .. Like this for all tags it is giving me error. I am getting my pdf file properly but i am not understanding why this is happenning then ?Jeremias Maerki-To unsubscribe, e-mail: [EMAIL PROTECTED]For additional commands, e-mail: [EMAIL PROTECTED] Do you Yahoo!? Yahoo! Mail - Find what you need with new enhanced search. Learn more.
Re: Getting huge no of errors
Here you are On 17.02.2005 09:47:36 Manisha Sathe wrote: i think as u mentioned am i passing wrong xsl file ? Would u mind passing me simplest xsl / xml files so that i can check with that. Jeremias Maerki Ticket.xml Description: Binary data xml2fo.xslt Description: Binary data - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Escape problem ?
Aha. Since Java internally uses Unicode you should be able to simply pass in the normal Unicode character, not the already escaped character because DOM will think that you want to output text (#x2205;) not the character. Once you pass in the Unicode character the serializer should handle the Unicode character for you automatically. The whole thing is probably easier than you think. :-) On 17.02.2005 09:54:51 Manisha Sathe wrote: I am using DOM to generate xml file. And the chinese character string is a hardcoded one i.e. when i am setting value to xml node i am passing it string as #x2206; but DOM automatically converts this string and store into xml file as amp;#x2206, Can DOM take care of this ? I think i am asking Java related question but in case u know, pls let me know. I will also post it on Java forum. Jeremias Maerki - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Getting huge no of errors
Hi Jeremias Maerki, A BigThanksto u, I tried yr xml and xsl and i am not getting any error. Now i will check my xml/xsl exactly where i am going wrong butthat's my job. Thanks once again regards Manisha Jeremias Maerki [EMAIL PROTECTED] wrote: Here you areOn 17.02.2005 09:47:36 Manisha Sathe wrote: i think as u mentioned am i passing wrong xsl file ? Would u mind passing me simplest xsl / xml files so that i can check with that. Jeremias Maerki ATTACHMENT part 2 application/octet-stream name=Ticket.xml ATTACHMENT part 3 application/octet-stream name=xml2fo.xslt-To unsubscribe, e-mail: [EMAIL PROTECTED]For additional commands, e-mail: [EMAIL PROTECTED] Do you Yahoo!? Yahoo! Search presents - Jib Jab's 'Second Term'
Bullets in FOP
Hi , How do I get bullets (Circle,Square and Filled Dot in FOP ) . Thanks Rohit - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Bullets in FOP
Hi, You can use: - either explicit character or character entity; - or glyph image (bitmap or svg). Characters that can replace wished bullets can be: #x2022; (filled circle); (this is part of standard font charsets) #x25a0; to #25f7; unicode page (geometric shapes) Caution: the used font must embed wished characters. Pascal -Message d'origine- De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Envoyé : jeudi 17 février 2005 14:40 How do I get bullets (Circle,Square and Filled Dot in FOP ) . - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Bullets in FOP
Thanks Pascal :). Regards Rohit Pascal Sancho [EMAIL PROTECTED] To: [EMAIL PROTECTED] akoma.frcc: Subject: RE: Bullets in FOP 02/17/2005 09:01 AM Please respond to fop-user Hi, You can use: - either explicit character or character entity; - or glyph image (bitmap or svg). Characters that can replace wished bullets can be: #x2022; (filled circle); (this is part of standard font charsets) #x25a0; to #25f7; unicode page (geometric shapes) Caution: the used font must embed wished characters. Pascal -Message d'origine- De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Envoyé : jeudi 17 février 2005 14:40 How do I get bullets (Circle,Square and Filled Dot in FOP ) . - 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]
RE: printing page numbers (closed)
Hi guys, Thanks so much for helping. I got it. It worked when I moved the Text-align to the fo:block for some reason I tried everything with fo:inline but it did not work. Thanks again. Jaysheel. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 16, 2005 4:13 PM To: [EMAIL PROTECTED] Subject: RE: printing page numbers Move the text-align property to the fo:block element (and you can then remove the inline wrapper, since text-align is its only attribute). Jay Bryant Bryant Communication Services (presently consulting at Synergistic Solution Technologies) Jaysheel Bhavsar [EMAIL PROTECTED] 02/16/2005 02:48 PM Please respond to [EMAIL PROTECTED] To [EMAIL PROTECTED] cc Subject RE: printing page numbers Hi, Here is part of my xsl sheet it is working fine, I get it to display page 1 of x. Now the problem I am running into is I cannot align my text for some reason. I have tried end and right but my text page 1 of x always stays on the left. Is there something I am missing. Is this because its in the footer of the page? -- fo:layout-master-set !-- layout for the first page -- fo:simple-page-master master-name=test page-height=11in page-width=8.5in margin-bottom=0.25in margin-top=0.25in fo:region-before extent=1.5cm/ fo:region-body margin-top=0.2in/ fo:region-start extent=1.0in/ fo:region-end extent=0.3in/ fo:region-after extent='1.0cm' region-name=footer/ /fo:simple-page-master /fo:layout-master-set fo:page-sequence master-reference=test initial-page-number=1 !-- usage of page layout -- !-- header -- fo:static-content flow-name=footer fo:block font-family=Helvetica font-size=7pt fo:inline text-align=end Page fo:page-number/ of fo:page-number-citation ref-id=last-page/ /fo:inline /fo:block /fo:static-content fo:flow flow-name=xsl-region-body fo:block xsl:apply-templates/ /fo:block fo:block id=last-page/ /fo:flow /fo:page-sequence - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Using Date/number datatypes with SAX events (Re: Seeking for expert opinion)
I'm not sure I'm getting you. Anyway, SAX doesn't care about dates or floats, only strings, so you'd have to convert these datatypes yourself to a suitable string representation (dates to ISO8601 for example). Probably if you're following my example you can extend the EasyGenerationContentHandlerProxy (awesome name, right?) to handle special datatypes for you. In the end you simply have to call the characters() method to send the values as strings. HTH. On 17.02.2005 22:08:00 Glen Mazza wrote: Jeremias (or others), I'm converting over at work to this method you're describing below, using the embed sample you mention below--everything is going well so far. Question though: For date and number types within the various objects that represent the data, should I use String datatypes instead because of the subsequent SAX event handling, or will dates and floats/ints etc. still work fine with this method? Jeremias Maerki - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Getting huge no of errors
Manisha Sathe wrote: I tried yr xml and xsl and i am not getting any error. Now i will check my xml/xsl exactly where i am going wrong but that's my job. our style shett probably starts with a DOCTYPE declaration, probably for declaring entities like nbsp: !DOCTYPE xsl:stylesheet [ !ENTITY nbsp x160; ] Try use a JAXP directly as Jeremias hinted, and be sure to not override the usual default of not validating the XSLT for the stylesheet parser. If this doesn't help, check your JDK version and upgrade if necessary, and check your classpath and endorsed directories for undesirable XML parser libraries (there was a Crimson release, rather long ago, which validated on encountering a DOCTYPE with an internal subset even if not told to validate) You can also expand any entity declared in the DOCTYPE in the stylesheet, and get rid of the DOCTYPE decl completely. J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Escape problem ?
Manisha Sathe wrote: I am using DOM to generate xml file. And the chinese character string is a hardcoded one i.e. when i am setting value to xml node i am passing it string as #x2206; but DOM automatically converts this string and store into xml file as amp;#x2206, Use Java Unicode escapes (like '\u2206') for non-ASCII/characters in Java strings. Use XML characcter references (like '#x2206;') *only* in XML files. J.Pietschmann - 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]