xml/xsl pdf servlet output problem
i'm using the SimpleServlet which was posted prior (and attached). it works great with a .fo http://localhost:8088/fop/fop?fo=c:/dev/tmp/table.fo the trouble i'm seeing is this. using a very simple .xsl and .xml, the output is not getting sent to the outputstream, *however* the PDF is getting generated properly. i know this cuz i created a temporary file using the output contents and write it to my filesystem and can load this file fine. there are no errors generated (except stuff about fonts, with the .fo version spews as well), and all that is returned is a blank/white page. http://localhost:8088/fop/fop?xml=sample.xmlxsl=sample.xsl i attached the simpleservlet.java (with the mod to write out a file to c:/temp/foo.pdf), and my basic .xsl and .xml anybody seen this? rich SimpleServlet.java Description: Binary data sample.xsl Description: Binary data sample.xml Description: Binary data
xml-pdf servlet output timeout
Hi, I had writen a servlet who generates a dynamic PDF document with a long elaboration time (some minutes). In the mean time the client browser that had made the servlet request, shows the errors HTTP 500 - Internal server error or Unable to find the server or DNS error. The servlet elaboration continue without exception and produces the document ... but the result never arrives to the client. Someone knows more about this problem? Thanks Roberto Bonsignori
RE: xml/xsl pdf servlet output problem
Does it work in Netscape? It is probably the very annoying bug in Internet Explorer there is a lot of information in the fop-user archives, e.g.: http://marc.theaimsgroup.com/?l=fop-userm=101898344218255w=2 http://marc.theaimsgroup.com/?l=fop-userm=101900052502730w=2 You could try: http://localhost:8088/fop/fop?xml=sample.xmlxsl=sample.xsldummy=.pdf (that is, you add dummy=.pdf at the and of the url, so IE sees that extension just a guess, better explanation in the archives Peter i'm using the SimpleServlet which was posted prior (and attached). it works great with a .fo http://localhost:8088/fop/fop?fo=c:/dev/tmp/table.fo the trouble i'm seeing is this. using a very simple .xsl and .xml, the output is not getting sent to the outputstream, *however* the PDF is getting generated properly. i know this cuz i created a temporary file using the output contents and write it to my filesystem and can load this file fine. there are no errors generated (except stuff about fonts, with the .fo version spews as well), and all that is returned is a blank/white page.
first page must have no page number
I tried implementing this with two page-master's but failed- could someone please pass me the code to implement this. thanx -- Eric Smith
RE: xml-pdf servlet output timeout
Perhaps not a direct solution - but for large documents I try to kick off the process asyncronously with JMS. I have also found- due to unreliable browser rendering of pdf documents that storing the generated document as a file in a temporary directory works well. Because there is an asyncronous process, we have to poll to determine when the document is complete. Hope this is helpful Neil Wright -Original Message- From: bonsigno [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 08, 2002 3:18 AM To: [EMAIL PROTECTED] Subject: xml-pdf servlet output timeout Importance: High Hi, I had writen a servlet who generates a dynamic PDF document with a long elaboration time (some minutes). In the mean time the client browser that had made the servlet request, shows the errors HTTP 500 - Internal server error or Unable to find the server or DNS error. The servlet elaboration continue without exception and produces the document ... but the result never arrives to the client. Someone knows more about this problem? Thanks Roberto Bonsignori
import/include
Hi, Ofcourse this is a XSL question.Does using import/include increases the processing speed. I'm using Xalan and Fop. I tried importing a xsl with 43 variables instead of declaring them inside the main xsl.I didn't see any processing speed difference,I used my stop watch :-) to chk it. Regards Balaji. http://messenger.yahoo.com.au - Yahoo! Messenger - A great way to communicate long-distance for FREE!
Re: import/include
Balaji Loganathan wrote: Ofcourse this is a XSL question. I beleive xsl-list maillist (http://www.mulberrytech.com/xsl/xsl-list) is a better place for xslt-related questions. Does using import/include increases the processing speed. I don't think so, these facilities (like in others languages) are provided primarily for code reusing and structuring. I'm using Xalan and Fop. I tried importing a xsl with 43 variables instead of declaring them inside the main xsl.I didn't see any processing speed difference,I used my stop watch :-) to chk it. Think about using the same variables in another stylesheet in order to see benefits. -- Oleg Tkachenko Multiconn International, Israel
Page Borders
Guys have any of you used page borders with FOP, I can't get it to render them yet if I try my XSL-FO in Antenna House's evaluation package they are rendered as you would expect. Does FOP not implement this yet, I'm using 0.20.3 John *** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. Any unauthorised distribution or copying is strictly prohibited. Whilst Cedar Plc takes steps to prevent the transmission of viruses via e-mail, we can not guarantee that any email or attachment is free from computer viruses and you are strongly advised to undertake your own anti-virus precautions. Cedar Plc grants no warranties regarding performance, use or quality of any e-mail or attachment and undertakes no liability for loss or damage, howsoever caused.
Out of Memory Error !!
hi there !! i am getting out of memory error when i try to process a very large document containing a single fo:page-sequence tag a single fo:table tag. i have gone thru the mailing list looking for some solution to this problem but though the problems are similar i am not able to figure out the soluition in my case... as i cannot have more than one page-sequence to display my actual data... i want to know what can be done to get rid of this problem if some how i am able to break this page-sequence then i will be able to get rid of this problem... kindly help me out with this problem as i am a novice in with this FOP stuff.. if any further info is required then send a mail a [EMAIL PROTECTED] thanx lotza cheers !! Abhijat Upadhyay
Newbie question - underlining blank spaces.
Hi all. Is there any way to force FOP to underline a string, even if it is composed entirely of blank characters? I'm using fop-0.20.3, if that matters. I have a template which produces an underlined, fixed-length string in my pdf doc. It pads the string with spaces if necessary to make it the desired length. It works great, and a I get a padded string in the pdf document with the required length and everything is underlined. Great :-) The problem is when the string is composed entirely of blank spaces ... The string has the correct number of blank characters (white-space-collapse=false), but the string is not underlined. Is there a way to force FOP to underline a string, even if it is composed entirely of blank characters? Thanks for any help. Here is the template: !-- *** this is the format I want to use to display the string -- xsl:attribute-set name=dataText xsl:attribute name=font-familyCourier/xsl:attribute xsl:attribute name=font-size9pt/xsl:attribute xsl:attribute name=font-stylenormal/xsl:attribute xsl:attribute name=font-weightnormal/xsl:attribute xsl:attribute name=languageen-US/xsl:attribute xsl:attribute name=text-decorationunderline/xsl:attribute xsl:attribute name=white-space-collapsefalse/xsl:attribute /xsl:attribute-set !-- recursive template to pad a string with blanks -- xsl:template name=append-pad !-- the value with whatever padChar is passed in -- xsl:param name=padCharxsl:value-of select=' '//xsl:param xsl:param name=padVar/ xsl:param name=length/ xsl:choose !-- check here to see if the padVar is nil -- xsl:when test=boolean($padVar) xsl:choose xsl:when test=string-length($padVar) lt; $length xsl:call-template name=append-pad xsl:with-param name=padChar select=$padChar/ xsl:with-param name=padVar select=concat($padVar,$padChar)/ xsl:with-param name=length select=$length/ /xsl:call-template /xsl:when xsl:otherwisefo:inline xsl:use-attribute-sets=dataTextxsl:value-of select=concat(substring($padVar,1,$length),'#160;')//fo:inline/xsl:ot herwise /xsl:choose /xsl:when !-- *** if the padVar is nil, make a string of entirely blank space *** -- xsl:otherwise xsl:call-template name=append-pad xsl:with-param name=padChar select=$padChar/ xsl:with-param name=padVar select='#160;'/ xsl:with-param name=length select=$length/ /xsl:call-template /xsl:otherwise /xsl:choose /xsl:template -- Jack Donohue, Developer Synovation Incorporated. Providing integrated solutions for criminal justice. -- Tel 209.491.0978 x 409 Fax 209.571.8853 Support 209.491.3600 Toll Free 800.774.8430 -- http://www.synovation.com http://support.synovation.com
Re: Out of Memory Error !!
Hi Abhijit, Looks like it might be in a recursive mode or something. I am not totally aware of this kind or problem ,but how big is your document ? Are you using the combination of xml and xsl filer or just the fo file to print out in PDF? naveen Abhijat Upadhyay abhijat.upadhyayTo: '[EMAIL PROTECTED]' [EMAIL PROTECTED] @patni.com cc: Subject: Out of Memory Error !! 05/08/02 02:44 PM Please respond to fop-user hi there !! i am getting out of memory error when i try to process a very large document containing a single fo:page-sequence tag a single fo:table tag. i have gone thru the mailing list looking for some solution to this problem but though the problems are similar i am not able to figure out the soluition in my case... as i cannot have more than one page-sequence to display my actual data... i want to know what can be done to get rid of this problem if some how i am able to break this page-sequence then i will be able to get rid of this problem... kindly help me out with this problem as i am a novice in with this FOP stuff.. if any further info is required then send a mail a [EMAIL PROTECTED] thanx lotza cheers !! Abhijat Upadhyay
ANN: TIFFRenderer for FOP
Hello! For the people interested in faxing using xsl-fo and FOP I'm happy to announce TIFFRenderer for FOP. The homepage is at http://www.tkachenko.com/fop/tiffrenderer.html and here is some info: TIFFRenderer for FOP, version 0.9 TIFFRenderer is a small Java library extending Apache's FOP by providing possibility to output multi-page TIFF (Tagged Image File Format) images. [TIFF is one of the most popular and flexible of the current public domain raster file formats, which was primarily designed for raster data interchange and is standard format in faxing applications.] TIFFRenderer is not a real renderer on its own, it just extends org.apache.fop.render.awt.AWTRenderer class and encodes generated by that renderer AWT images to TIFF format. To actual encoding TIFFRenderer uses slightly modified free of charge open source TIFF codec [1] by Sun Microsystems, Inc. (Actually, a very similar TIFF codec is included in Batik distribution, but unfortunately it has very limited support for TIFF compression methods). TIFFRenderer has no dependencies on JAI, JIMI or other image processing libraries. For demonstration of using TIFFRenderer in a web application see TIFFRenderer Demo [2]. Features * Supported TIFF compression methods: o Raw uncompressed data o Byte-oriented run-length encoding PackBits compression o Modified Huffman Compression (CCITT Group 3 1D facsimile compression) o CCITT T.4 bilevel compression (CCITT Group 3 2D facsimile compression) o CCITT T.6 bilevel compression (CCITT Group 4 facsimile compression) o JPEG-in-TIFF compression o DEFLATE lossless compression (also known as Zip-in-TIFF) * Ability to add extra images before/after those generated by FOP. Requirements Not sure yet. Tested with FOP 0.20.3 under Sun JRE 1.3.1, 1.4. Definitely doesn't work under IBM JDK1.2.2 (WebShere 3.5) because of some bug in AWT implementation. Download and Installation * Compiled version: tifferenderer-0.9.jar (140 Kb) [3]. * Sources: tifferenderer-0.9-src.jar (180 Kb) [4]. Just put tiffrenderer-0.9.jar into the CLASSPATH. Testing: run TIFFRendererTest class with two arguments - xsl-fo file and tiff file to be generated (having fop related jars and tiffrenderer-0.9.jar in the CLASSPATH): java com.multiconn.fop.TIFFRendererTest table.fo table.tif Documentation See TIFFRenderer Javadoc [5]. Main pattern of using TIFFRenderer is a very primitive one: //Creates TIFFRenderer instance TIFFRenderer tiffRenderer = TIFFRendererFactory.newTIFFRenderer(); //Creates render/encode params collection TIFFRendererParams params = new TIFFRendererParams(); //Sets up params params.setCompression(TIFFRendererParams.COMPRESSION_GROUP3_1D); //Sets params to the renderer tiffRenderer.setRenderParams(params); //Sets renderer to the FOP driver driver.setRenderer(tiffRenderer); //Runs FOP driver.run(); See also TIFFRendererDemo servlet source [6] as example of using TIFFRenderer in a servlet. Licence issues TIFFRenderer is subject to the Mozilla Public License Version 1.0 and is distributed on an AS IS basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Original TIFF codec source code licence by Sun Microsystems, Inc.: JAI_1.1.1_sample_io_sourcecodelic.10_23_01.txt [7]. To be done * Diminish library size by eliminating duplicate classes, which are already in Batik jar. Feedback Any comments and suggestions would be greatly appreciated, feel free to contact me: [EMAIL PROTECTED]. Links: [1] http://developer.java.sun.com/developer/sampsource/jai [2] http://www.tkachenko.com/fop/TIFFRendererDemo [3] http://www.tkachenko.com/fop/tiffrenderer-0.9.jar [4] http://www.tkachenko.com/fop/tiffrenderer-0.9-src.jar [5] http://www.tkachenko.com/fop/tiffrenderer-doc/index.html [6] http://www.tkachenko.com/fop/TIFFRendererDemo/src/TIFFRendererDemoServlet.java [7] http://www.tkachenko.com/fop/JAI_1.1.1_sample_io_sourcecodelic.10_23_01.txt -- Oleg Tkachenko Multiconn International, Israel
fop-0.20.3 Don't know what to do with error
When I call the fop.bat that comes with fop-0.20.3 using a very simple hello world formatting object file in the same directory as fop.bat, I get an error that says (in its entirety) Don't know what to do with no matter what parameters I supply. This is under Win98, and the same fo input file works with the obvious parameters when I run it with the fop.bat in my Fop-0.18.1-DEV directory. I got the impression from another posting that getting jimi-1.0.jar would fix it, so I copied the Fop-0.18.1-DEV\lib one to fop-0.20.3\lib directory and that didn't help. I then got jimi1_0.zip from http://java.sun.com/products/jimi/, but its only jar file is JimiProClasses.jar. Anyway, according to http://xml.apache.org/fop/relnotes.html, jimi is only needed for PNG support, and the document has no pictures of any kind. Does anyone know what the problem might be? thanks, Bob DuCharme www.snee.com/bob bob@ snee.com The elements be kind to thee, and make thy spirits all of comfort! Anthony and Cleopatra, III ii
PDF embedding
What's the cleanest way to embedded a PDF inside a PDF file using FOP? Thanks much for the help. Patrick Lanphier The Artemis Group http://www.artemisgroup.com phone: 814-235-0444 fax: 800-582-9710
Re: PDF embedding
Patrick Lanphier wrote: What's the cleanest way to embedded a PDF inside a PDF file using FOP? You'll probably have to implement an extension element or an image handler. Alternatively, try iText http://www.lowagie.com to mix arbitrary PDF, including PDF generated by FOP and your existing PDF. J.Pietschmann
Re: xml-pdf servlet output timeout
bonsigno wrote: Hi, I had writen a servlet who generates a dynamic PDF document with a long elaboration time (some minutes). In the mean time the client browser that had made the servlet request, shows the errors HTTP 500 - Internal server error or Unable to find the server or DNS error. The servlet elaboration continue without exception and produces the document ... but the result never arrives to the client. Someone knows more about this problem? There are some HTTP tricks to keep the browser from getting a timeout. Multipart MIME may work, spawn the PDF generator off as Java thread, push some HTML saying Please Wait and a space every odd second (flush the stream), and push the PDF as the second part. (maybe this helps: http://lists.w3.org/Archives/Public/www-talk/2000NovDec/0064.html ) Another possibility is to use automatic refresh, again spawn the PDF generator, push a Please Wait HTML, if the PDF is requested again check whether there is the generator thread, if it's still working push the HTML again, otherwise send the PDF. J.Pietschmann
Re: Java 1.1.x
Hello Everyone, This is for those of you who are interested in running FOP under Java 1.1.8. I am successfully using version 0.17 in a servlet running on a Domino R5 Server. It was really not that hard to get going. The only real difficulty was in conforming to the version of FO-XML supported under version 0.17. Thanks for the feed back, Kendall Adkins Sr. Project Lead Infoadvantage, Inc. http://www.infoad.com [EMAIL PROTECTED] Peter B. WestTo: [EMAIL PROTECTED] [EMAIL PROTECTED] cc: p.com.auSubject: Re: Java 1.1.x 05/06/2002 07:30 PM Please respond to fop-user Kendall, You might want to examine this thread: http://marc.theaimsgroup.com/?l=fop-devm=101551941500565w=4 I don't know whether this is the only problem of the migration to 1.2/1.3. If it were, you could copy the source tree, and use a find and a perl one-liner to change all of the occurrences. Not nice, and nasty to keep up-to-date, but it may be a way out. If it were not, you will have to follow Joerg's suggestion. Does anyone else know what the relevant incompatibilities are? Peter J.Pietschmann wrote: Kendall Adkins wrote: I have a client who is using a Domino server. Domino only supports the Java 1.1.8 SDK. I have been unable to find a version of FOP that will run with this SDK. Does anyone have any suggestions? Recent FOP versions need JDK1.2, perhaps even 1.3. I think you should look for 0.18 or even 0.17 on the old versions archive.
Re: File seems to be kept open!
Mirko Sertic wrote: After the renderer has done its work, i want to delete my temp files. I can delete every temp file except the image files!!! (the java java.io.File.delete() method gives a false as return value, so the the file is not deleted and is still alive in my temp dir!!!). The files are automatically closed when the corresponding Java objects are garbage collected. This will happen sooner or later, so you can simply try to delete *all* temporary image files and ignore the ones which are not yet closed. Another possibility is to explicitely force garbage collection check the JavaDoc for the System or Runtime class. Be careful to set references to the driver object to null beforehand: driver.render(); driver=null; System.gc(); // or whatever J.Pietschmann
Re: Newbie question - underlining blank spaces.
Jack Donohue wrote: Is there any way to force FOP to underline a string, even if it is composed entirely of blank characters? I'm using fop-0.20.3, if that matters. Try something which results in fo:inline text-decoration=underline#x005F; #160;/fo:inline The first is the underline character, the last a non breaking space. J.Pietschmann
Re: fop-0.20.3 Don't know what to do with error
DuCharme, Bob (LNG) wrote: When I call the fop.bat that comes with fop-0.20.3 using a very simple hello world formatting object file in the same directory as fop.bat, I get an error that says (in its entirety) Don't know what to do with no matter what parameters I supply. This is under Win98, and the same fo input file works with the obvious parameters when I run it with the fop.bat in my Fop-0.18.1-DEV directory. I got the impression from another posting that getting jimi-1.0.jar would fix it, Hardly. The problem appears to be that the command line passed by the Win98 command processor to the JVM contains some character at the end which the JVM passes as additional parameter to the Java code (possibly a CR). This problem seems to be specific to the DOS based COMMAND.COM included in Win95/98/ME and some JVM versions. You could help by running the following test program with one or two arbitrary parameters and post the output. public class TestC { static final char[] hex={'0','1','2','3','4','5','6','7', '8','9','A','B','C','D','E','F'}; static public void main(String[] arg) { for( int i=0;iarg.length;i++ ) { byte[] b=arg[i].getBytes(); for( int j=0;jb.length;j++ ) { System.out.print(+hex[b[j]/16]+hex[b[j]%16]+' '); } System.out.println(); } } } There is no workaround known to me, you'll have to experiment by yourself a bit. Perhaps the problem goes away if you use the command line from the batch file directly instead of the file. J.Pietschmann
Re: first page must have no page number
Eric Smith wrote: I tried implementing this with two page-master's but failed- could someone please pass me the code to implement this. ?xml version=1.0 encoding=iso-8859-1? fo:root xmlns:fo=http://www.w3.org/1999/XSL/Format; fo:layout-master-set fo:simple-page-master master-name=regular page-height=29.7cm page-width=21cm margin-top=1cm margin-bottom=2cm margin-left=2.5cm margin-right=2.5cm fo:region-body margin-bottom=1.5cm/ fo:region-after extent=1.5cm/ /fo:simple-page-master fo:simple-page-master master-name=blank-footer page-height=29.7cm page-width=21cm margin-top=1cm margin-bottom=2cm margin-left=2.5cm margin-right=2.5cm fo:region-body margin-bottom=1.5cm/ /fo:simple-page-master fo:page-sequence-master master-name=pages fo:repeatable-page-master-alternatives fo:conditional-page-master-reference page-position=first master-reference=blank-footer / fo:conditional-page-master-reference page-position=rest master-reference=regular / /fo:repeatable-page-master-alternatives /fo:page-sequence-master /fo:layout-master-set fo:page-sequence master-reference=pages fo:static-content flow-name=xsl-region-after fo:blockfo:page-number//fo:block /fo:static-content fo:flow flow-name=xsl-region-body fo:blockStuff/fo:block fo:block break-before=pageStuff/fo:block /fo:flow /fo:page-sequence /fo:root J.Pietschmann
turn off logging
I attempted to turn off logging by adding the following to my servlet init routing: MessageHandler.setOutputMethod(MessageHandler.NONE) However, I still get all this stuff. I've search and trying to figure out how to configure the servlet/webapp to not print all this information. Is there a way to set the Logger? Thanks, Rich 5/8/02 12:39:20:936 HST] 65889399 SystemOut U [ERROR]: Logger not set [5/8/02 12:39:21:467 HST] 65889399 SystemOut U [INFO]: building formatting object tree [5/8/02 12:39:22:068 HST] 65889399 SystemOut U [INFO]: [1] [5/8/02 12:39:23:500 HST] 65889399 SystemOut U [INFO]: [2] [5/8/02 12:39:23:510 HST] 65889399 SystemOut U [INFO]: Parsing of document complete, stopping renderer [5/8/02 12:39:23:580 HST] 65889399 SystemOut U [ERROR]: Logger not set [5/8/02 12:39:23:590 HST] 65889399 SystemOut U [INFO]: building formatting object tree [5/8/02 12:39:23:740 HST] 65889399 SystemOut U [INFO]: [1] [5/8/02 12:39:23:941 HST] 65889399 SystemOut U [INFO]: [2] [5/8/02 12:39:23:951 HST] 65889399 SystemOut U [INFO]: Parsing of document complete, stopping renderer