Re: compressing pdf response
Thanks to you all! If the improvement is so small I will unplug the filter. Although the browsers do support compression (the filter is checking this), the outcome seems to be somewhat unpredictable, and I don't know anything about the client side in production, of course. sonja Am Montag, den 19.09.2005, 21:48 +0200 schrieb J.Pietschmann: Sonja Löhr wrote: With IE (that is, acrobat inside) I get sometimes the pdf and sometimes a blank page, after reloading the message about a damaged file. Firefox (always) complains that the file doesn't begin with %PDF- (ok, indeed both speak German ;-) The browser explicitly asks if it will accept a compressed response. The server is *not* allowed to use compression (at the HTTP level) if the browser doesn't ask for it. Check your browser configuration. In Firefox, you might try the HTTP live headers extension for sniffing the actual values. Also, most of the PDF parts are already compressed (and re-encoded as ASCII85). A secondary compression will probably gain something between 15% and 20% for typical PDF files. Significant improvements are only to be expected in case of large embedded BMP images and in some cases if there are large embedded fonts. J.Pietschmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Sonja Löhr [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
compressing pdf response
Hi! This is not a FOP question, but you I'm sure you are familiar with these things I use FOP in a servlet and would like to add a CompressionFilter since the output pdf is very large. I tried to get the output with firefox and IE the Browsers cannot handle the output. (IE sometimes (?) can, firefox never. The actual compression is that one: gzipstream = new GZIPOutputStream(output); flushToGZip(); response.addHeader(Content-Encoding, gzip); response.setContentType(application/pdf); I added the last line since I hoped it could help (additionally), but it doesn't. Is there something else I could try to configure on any of the Streams concerned? Before compressing, both browsers pass a test whether compressed data are accepted. Thanks for you help again! sonja - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: compressing pdf response
Hi, Carol! Thank you. This is exactly the code I use :-) With IE (that is, acrobat inside) I get sometimes the pdf and sometimes a blank page, after reloading the message about a damaged file. Firefox (always) complains that the file doesn't begin with %PDF- (ok, indeed both speak German ;-) -Original Message- From: cgray [mailto:[EMAIL PROTECTED] Sent: Montag, 19. September 2005 18:58 To: fop-users@xmlgraphics.apache.org Subject: Re: compressing pdf response Hi Sonja, The article below, by Jason Hunter, discusses creating a filter to handle compression. It also has links to samples to download. I haven't used this, but it looks like it might be of help. Carol http://www.javaworld.com/javaworld/jw-06-2001/jw-0622-filters-p3.html Sonja Löhr wrote: Hi! This is not a FOP question, but you I'm sure you are familiar with these things I use FOP in a servlet and would like to add a CompressionFilter since the output pdf is very large. I tried to get the output with firefox and IE the Browsers cannot handle the output. (IE sometimes (?) can, firefox never. The actual compression is that one: gzipstream = new GZIPOutputStream(output); flushToGZip(); response.addHeader(Content-Encoding, gzip); response.setContentType(application/pdf); I added the last line since I hoped it could help (additionally), but it doesn't. Is there something else I could try to configure on any of the Streams concerned? Before compressing, both browsers pass a test whether compressed data are accepted. Thanks for you help again! sonja - 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: upgrading from 20.0.5 to the trunk
That positioning was totally arbitrary, so I moved generate-id onto the cell and everything is fine! Thank you once more :-) sonja Am Dienstag, den 13.09.2005, 18:53 +0200 schrieb Jeremias Maerki: I should have realized from your snippets what was wrong. D'oh! The problem is that on certain FOs the id property is not properly processed, yet, and therefore not available to page-number-citation. This was properly shown in our test cases but not on our compliance page and I didn't remember, so I've updated the compliance page with the details (not live, yet): http://svn.apache.org/viewcvs?rev=280586view=rev ATM, you can't use an ID defined on table-row. Please try to move the id to the first table-cell in the row and it should work. I hope we'll have time to fix that eventually. On 13.09.2005 18:22:29 Sonja Löhr wrote: Am Dienstag, den 13.09.2005, 17:41 +0200 schrieb Jeremias Maerki: You can send the FO file to me directly, and I'll try to isolate the problem so I can create a simple, automatable test case for our collection. case it is not my fault!! The file is on its way ... On 13.09.2005 17:22:33 Sonja Löhr wrote: Can you provide an example? I can't reproduce the problem. Thanks. Of course. Shall/May I attach the whole big fo file here so you could just plug it in? Here are some snippets. The index table of contents has its own page-sequence-master as it is in two columns. In the pdf output, there is just one question mark instead of a number. I already simplyfied index to exclude problems with overflow or so. fo:page-sequence language=de hyphenate=false initial-page-number=3 master-reference=inhaltsverzeichnis fo:static-content flow-name=toc-odd-after fo:block padding-top=0.6cm text-align=end fo:page-number/ /fo:block /fo:static-content fo:static-content flow-name=toc-even-after fo:block padding-top=0.6cm text-align=start fo:page-number/ /fo:block /fo:static-content fo:flow flow-name=xsl-region-body fo:block space-after=1.5cm font-size=20ptInhalt/fo:block fo:block fo:page-number-citation ref-id=N1005A/ : Bartschneider /fo:block fo:block fo:page-number-citation ref-id=N1006A/ : Dampfbügeleisen /fo:block fo:block fo:page-number-citation ref-id=N1007A/ : ProStyle Bügeleisen /fo:block [and so on] /fo:flow /fo:page-sequence fo:page-sequence hyphenate=true master-reference=content [A long, long table with table-header, some of the table rows (those containing the group name) carry the ids for the page-number-citation:] fo:table-row height=2.2cm id=N1005A fo:table-cell border=0.2mm solid black display-align=center number-columns-spanned=8 fo:block start-indent=3.6cm font-weight=bold font-size=24pt display-align=center space-before=0.8cm Bartschneider /fo:block /fo:table-cell /fo:table-row [...] /fo:page-sequence snip/ Jeremias Maerki - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Sonja Löhr [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Jeremias Maerki - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Sonja Löhr [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: upgrading from 20.0.5 to the trunk
Ok, I can now answer some of my questions myself ;-) I use the Fop class instead of the Driver class, right? I'll try to change the code according to the source of FopServlet, putting the extra steps somwhere between. But some questions remain: a) What about the configuration? I have had the following for fop-20.0.5: org.apache.fop.configuration.Configuration.put(baseDir, ctx.getRealPath(/)); org.apache.fop.configuration.Configuration.put(fontBaseDir, ctx.getRealPath(/WEB-INF/fonts)); org.apache.fop.configuration.Configuration.put(strokeSVGText, false); File userConfigFile = new File(ctx.getRealPath(CONFIG_FILE)); new Options(userConfigFile); b) My app already uses commons.logging with log4j. May I just do nothing more and FOP will log onto the same appender as my servlet does? Greetings! sonja Am Montag, den 12.09.2005, 11:40 +0200 schrieb Sonja Löhr: Hi! After inspecting the new compliance page (:-)) great improvements!!), I finally downloaded the trunk and built it. Now my servlet code is missing several packages/classes : org.apache.fop.messaging org.apache.fop.configuration and classes in org.apache.fop.apps (Driver and Options) Did I miss some sources or where can I find documentation about a new way of programmatic configuration, logging and Servlet integration? Sorry, I'm a bit lost in the developer's section of the fop site. Thank you for some hints, I would love to use the new features! sonja - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Sonja Löhr [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: upgrading from 20.0.5 to the trunk
Thank you for the turbo-answer, Jeremias! We wrote at the same time ... I would be brave ;-) and change the code since it is really small and differs not much from what happens in FopServlet, I just have some In- and OutputStreams between but should come along with the javadoc for that. The only complex thing could be the configuration (with both config-file and programmatically) - is that a great thing to change? If it is, I would just wait for the release and don't bother you with questions. sonja Am Montag, den 12.09.2005, 11:57 +0200 schrieb Jeremias Maerki: Sorry, Sonja, but a lot of changes have happened during the redesign which break API compatibility. The packages and classes you listed don't exist anymore. And the new API has not been documented, yet. This will be done in the next two weeks and before the first preview release. In the meantime, you can look at the embedding examples in examples/embedding on how to embed FOP Trunk in a Java application. If you prefer an API that works on both FOP 0.20.5 and FOP Trunk, I have started a solution at http://www.jeremias-maerki.ch/dev/jaxg/index.html. But either way, you will have to change your application once. Also needless to say that FOP Trunk is unstable (alpha) as will be the first preview release. On 12.09.2005 11:40:50 Sonja Löhr wrote: Hi! After inspecting the new compliance page (:-)) great improvements!!), I finally downloaded the trunk and built it. Now my servlet code is missing several packages/classes : org.apache.fop.messaging org.apache.fop.configuration and classes in org.apache.fop.apps (Driver and Options) Did I miss some sources or where can I find documentation about a new way of programmatic configuration, logging and Servlet integration? Sorry, I'm a bit lost in the developer's section of the fop site. Thank you for some hints, I would love to use the new features! sonja Jeremias Maerki - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Sonja Löhr [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: upgrading from 20.0.5 to the trunk
I try learning ... Could you please just tell me whether I am on the right track for configuration with the fop-trunk? DefaultConfigurationBuilder confbuilder = new DefaultConfigurationBuilder(); Configuration fileconf = confbuilder.buildFromFile(ctx.getRealPath(CONFIG_FILE)); DefaultConfiguration conf = new DefaultConfiguration(fileconf); conf.setAttribute(strokeSVGText, false); conf.setAttribute(fontBaseDir, ctx.getRealPath(/WEB-INF/fonts)); conf.setAttribute(baseDir, ctx.getRealPath(/)); . Fop fop = new Fop(Fop.RENDER_PDF); fop.getUserAgent().setUserConfig(conf); . or fop.getUserAgent().setBaseURL() instead of specifying this inside the DefaultConfiguration? (Font basedir is not essential since it is under baseDir) Leaving now, I'll simply try tomorrow if no veto occurs ;-) Thanks in advance! sonja Am Montag, den 12.09.2005, 12:12 +0200 schrieb Sonja Löhr: Thank you for the turbo-answer, Jeremias! We wrote at the same time ... I would be brave ;-) and change the code since it is really small and differs not much from what happens in FopServlet, I just have some In- and OutputStreams between but should come along with the javadoc for that. The only complex thing could be the configuration (with both config-file and programmatically) - is that a great thing to change? If it is, I would just wait for the release and don't bother you with questions. sonja Am Montag, den 12.09.2005, 11:57 +0200 schrieb Jeremias Maerki: Sorry, Sonja, but a lot of changes have happened during the redesign which break API compatibility. The packages and classes you listed don't exist anymore. And the new API has not been documented, yet. This will be done in the next two weeks and before the first preview release. In the meantime, you can look at the embedding examples in examples/embedding on how to embed FOP Trunk in a Java application. If you prefer an API that works on both FOP 0.20.5 and FOP Trunk, I have started a solution at http://www.jeremias-maerki.ch/dev/jaxg/index.html. But either way, you will have to change your application once. Also needless to say that FOP Trunk is unstable (alpha) as will be the first preview release. On 12.09.2005 11:40:50 Sonja Löhr wrote: Hi! After inspecting the new compliance page (:-)) great improvements!!), I finally downloaded the trunk and built it. Now my servlet code is missing several packages/classes : org.apache.fop.messaging org.apache.fop.configuration and classes in org.apache.fop.apps (Driver and Options) Did I miss some sources or where can I find documentation about a new way of programmatic configuration, logging and Servlet integration? Sorry, I'm a bit lost in the developer's section of the fop site. Thank you for some hints, I would love to use the new features! sonja Jeremias Maerki - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Sonja Löhr [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ) pagination and width=100%
Sorry, the code got really worse when sending the email. I now caught the fo-output of a test-doc between two processing steps and put some example images on my server, so you should be able to reproduce everything, including the wrong table-width. It is attached here. Bye! sonja -Original Message- From: Sonja Löhr [mailto:[EMAIL PROTECTED] Sent: Dienstag, 23. August 2005 13:09 To: fop-users@xmlgraphics.apache.org Subject: (re:) pagination and width=100% Hi! Some days ago we talked about the problem of wrong computation of table-widths if a break between two pages occurs and the region-bodies (or column-widths) of these to pages differ in width. I use something like the following to keep the headline and first paragraph of an article together. Actually, it is a bit more complicated because not only ps may occur first, but that shouldn't make a difference. xsl:template match=article !-- Headline and first paragraph -- fo:block font-size=11pt space-after=0.6cm fo:table table-layout=fixed width=100% fo:table-column column-width=proportional-column-width(1)/ fo:table-body fo:table-row keep-with-next=always keep-together=always xsl:apply-templates select=headline mode=content/ /fo:table-row fo:table-row keep-together=always fo:table-cellxsl:apply-templates select=p[1]//fo:table-cell /fo:table-row /fo:table-body /fo:table xsl:apply-templates select=p[position() gt; 1]/ /fo:block /xsl:template The evil part is that one (shortened): fo:simple-page-master master-name=first page-height=29.7cm page-width=21cm margin-top=0cm margin-bottom=2.2cm margin-left=2.5cm margin-right=2.5cm fo:region-body margin-top=7cm margin-bottom=0cm margin-left=7cm/ fo:region-before precedence=true region-name=first-before extent=7.5cm/ fo:region-start region-name=first-start extent=5.6cm/ /fo:simple-page-master The other fo:simple-page master objects don't have this region-start and therefore don't have such a big left margin on their region-body. (There is a box containing the the contents on on the left of the first page). So what happens is that if there really has to be a page-break from page 1 to page2 when a new article starts, the headline-p1-table will have the width of the first page's region-body. After that headline-p1-table everything is fine. Hmm, my customer was so sold on that content-box on the left side ;-), in the end I will have to remove it... Greetings and many thanks! sonja - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] testOutput.fo Description: Binary data - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Pagination Problem
Hi! I can't help ;-(, but for those who can, I just want to add a related observation: I put each headline in a table together with the following paragraph, with keep-with-next and keep-together, the table should have a width of 100%. If a page break occured before such a table (and only then), FOP seemed to not recognize it early enough: The table indeed displayed on the next page, but the percentual width is 100% of the width in the previous page. (I used 2 columns on pages greater than 1 and some box in region-start of the first page, so the text-width differed.) Regards, sonja Am Donnerstag, den 18.08.2005, 12:47 -0700 schrieb Ken Johnson: Hello, I am having a pagination problem with FOP 0.20.5. The problem occurs when the entire contents of a table row does not fit on a page. A new page seems to be generated but the table row's content is not rendered on the new page. It seems to be rendered on the previous page even though it presumably would not fit. I believe this is a previously reported bug. In the event that this is the final table row containing content, the resulting document will have an extra blank page. Very undesirable indeed. The following example illustrates the problem. Row 2 is rendered on the first page and a blank second page is created. If a third row is added to the table, it gets rendered on the second page and the document appears correct. Does anyone know of possible a workaround for the problem? Any help is greatly appreciated. Thanks, Ken ?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 page-width=8.5in page-height=11in margin-right=.25in margin-left=.25in margin-top=.25in margin-bottom=.25in master-name=ThePage fo:region-body margin-top=5in margin-bottom=5in/ /fo:simple-page-master fo:page-sequence-master master-name=repeating fo:repeatable-page-master-reference master-reference=ThePage/ /fo:page-sequence-master /fo:layout-master-set fo:page-sequence master-reference=repeating language=en hyphenate=true initial-page-number=1 force-page-count=no-force fo:flow flow-name=xsl-region-body fo:block fo:table width=5in table-layout=fixed fo:table-column column-number=1 column-width=proportional-column-width(100)/ fo:table-body fo:table-row keep-together=always fo:table-cell column-number=1 fo:block text-align=left This is row 1/fo:block /fo:table-cell /fo:table-row fo:table-row keep-together=always fo:table-cell column-number=1 fo:block text-align=left This is row 2/fo:block /fo:table-cell /fo:table-row /fo:table-body /fo:table /fo:block /fo:flow /fo:page-sequence /fo:root - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Sonja Löhr [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Pagination Problem
Thanks, Jeremias! My customer finally prefered a one-column layout, so I didn't see the error again. But theoretically, it could still occur, since the first page still has this box in its region-start. If I revisit that project in the next days, I'll try to reproduce the error and get an output of the FP tree - by the time I wait for other errors to be reported by my customer ;-) Am Freitag, den 19.08.2005, 09:27 +0200 schrieb Jeremias Maerki: I can confirm Ken's problem, but I don't have any work-around, I'm afraid. It's probably a bug but one that's not going to be fixed. I can also confirm that this particular problem doesn't occur in the current development code (as if that would help, sorry). Sonja's problem seems to be something else. It would help to have an FO file to reproduce it. Anyway, the thing she describes will not be possible for some time with the development code (for the devs: changing available IPD problem). This is quite tricky stuff for us coders. To avoid any problems you should put the headline page and the following pages in a different page-sequence and try not to have to flow content from the first to the second page. That should work for both FOP versions. On 19.08.2005 09:13:13 Sonja Löhr wrote: Hi! I can't help ;-(, but for those who can, I just want to add a related observation: I put each headline in a table together with the following paragraph, with keep-with-next and keep-together, the table should have a width of 100%. If a page break occured before such a table (and only then), FOP seemed to not recognize it early enough: The table indeed displayed on the next page, but the percentual width is 100% of the width in the previous page. (I used 2 columns on pages greater than 1 and some box in region-start of the first page, so the text-width differed.) Regards, sonja Am Donnerstag, den 18.08.2005, 12:47 -0700 schrieb Ken Johnson: Hello, I am having a pagination problem with FOP 0.20.5. The problem occurs when the entire contents of a table row does not fit on a page. A new page seems to be generated but the table row's content is not rendered on the new page. It seems to be rendered on the previous page even though it presumably would not fit. I believe this is a previously reported bug. In the event that this is the final table row containing content, the resulting document will have an extra blank page. Very undesirable indeed. The following example illustrates the problem. Row 2 is rendered on the first page and a blank second page is created. If a third row is added to the table, it gets rendered on the second page and the document appears correct. Does anyone know of possible a workaround for the problem? Any help is greatly appreciated. Thanks, Ken ?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 page-width=8.5in page-height=11in margin-right=.25in margin-left=.25in margin-top=.25in margin-bottom=.25in master-name=ThePage fo:region-body margin-top=5in margin-bottom=5in/ /fo:simple-page-master fo:page-sequence-master master-name=repeating fo:repeatable-page-master-reference master-reference=ThePage/ /fo:page-sequence-master /fo:layout-master-set fo:page-sequence master-reference=repeating language=en hyphenate=true initial-page-number=1 force-page-count=no-force fo:flow flow-name=xsl-region-body fo:block fo:table width=5in table-layout=fixed fo:table-column column-number=1 column-width=proportional-column-width(100)/ fo:table-body fo:table-row keep-together=always fo:table-cell column-number=1 fo:block text-align=left This is row 1/fo:block /fo:table-cell /fo:table-row fo:table-row keep-together=always fo:table-cell column-number=1 fo:block text-align=left This is row 2/fo:block /fo:table-cell /fo:table-row /fo:table-body /fo:table /fo:block /fo:flow /fo:page-sequence /fo:root - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Sonja Löhr [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Jeremias Maerki
RE: Relative URLs
Hi! First of all: You are really a great mailing list!! Helpful comments almost immediately, every time :-) Setting the basedir in the config file is working - thank you! It is no perfect solution as I still have to once more note the installation directory, but I already reference my fonts that way and get along setting CATALINA_HOME for Ant ... Passing request.getServerName (and perhaps request.getServerPort()) is what I would have used... indeed, I already do something similar in a preprocessing step (for the simulation of floats) to manage Server (not tomcat)-relative URLs. Being interested generally, if anybody knows/finds the default of this basedir in a servlet environment where no real fo files are written, please let me know! Regards, sonja -Original Message- From: J.Pietschmann [mailto:[EMAIL PROTECTED] Sent: Freitag, 12. August 2005 22:20 To: fop-users@xmlgraphics.apache.org Subject: Re: Relative URLs Sonja Löhr wrote: I now try to replace an absolute URL on an external-graphic element with a relative one. You'll probably need to set the baseDir in the FOP configuration. See http://xml.apache.org/fop/embedding.html#config-internal Try getRealPath(/) on the servlet context in order to get a useful file system path. J.Pietschmann - 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: Relative URLs
Ah! I misunderstood you. Yes, if I do the configuration programmatically instead of my fop-config.xml, of course I have dynamic access to everything! Great, I'll check now if I could reference font-metrics and embedded fonts this way as well. Thank you VERY much! -Original Message- From: J.Pietschmann [mailto:[EMAIL PROTECTED] Sent: Freitag, 12. August 2005 22:20 To: fop-users@xmlgraphics.apache.org Subject: Re: Relative URLs Sonja Löhr wrote: I now try to replace an absolute URL on an external-graphic element with a relative one. You'll probably need to set the baseDir in the FOP configuration. See http://xml.apache.org/fop/embedding.html#config-internal Try getRealPath(/) on the servlet context in order to get a useful file system path. J.Pietschmann - 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: Relative URLs in Servlet-created FO
Mike (and others), I'm now very content with my configuration and will summarize it shortly: The configuration xml is now very short: configuration fonts font metrics-file=font1.xml kerning=yes embed-file=../ttf/Ss__.ttf font-triplet name=customFont style=normal weight=normal/ /font font metrics-file=font1_b.xml kerning=yes embed-file=../ttf/Sssb.ttf font-triplet name=customFont style=normal weight=bold/ /font /fonts /configuration and my Servlet's init() starts with ServletContext ctx = getServletContext(); new Options(new File(ctx.getRealPath(CONFIG_FILE))); org.apache.fop.configuration.Configuration.put(baseDir, ctx.getRealPath(/)); org.apache.fop.configuration.Configuration.put(fontBaseDir, ctx.getRealPath(/WEB-INF/fonts)); The logo is referenced inside the stylesheet with: fo:external-graphic src=url(headers/logo2.svg) / (headers being a directoy under the context root, fonts and ttf are under WEB-INF) Greetings and thanks again, sonja -Original Message- From: Mike Trotman [mailto:[EMAIL PROTECTED] Sent: Freitag, 12. August 2005 21:28 To: fop-users@xmlgraphics.apache.org Subject: Re: Relative URLs I had some similar problems last year - but can't remember how I solved them. I have a nasty feeling that I ended up passing server names etc. as XSLT parameters. I also had problems between a version of XEP and FOP in their interpretation of url() contents - which differed. The resolution of url() paths may depend on when they are processed (i.e which document) and by what. So - the paths should be processed relative to the location of your FO file. If the FO file is produced in memory - then the relative base probably depends on the application. You could try using the 'xml:base' attribute on an element in the FO to define what should be taken as the base url for that element and child elements - but I haven't tried this with FOP - so don't know if it works / is supported. I too will be interested to see any helpful comments on this. Mike Sonja Löhr wrote: It's me again ... All my fonts in place, I still seem to be not fit enough for handling paths ;-) I now try to replace an absolute URL on an external-graphic element with a relative one. FO is created via XSLT, and my stylesheet resides in a subfolder of WEB-INF. In- and OutputStreams before and after, but that shouldn't matter. fo:external-graphic src=http://localhost:8080/pdfnewsletter/headers/logo.svg/ is working well here, but I cannot be sure whether the production server will really be listening to localhost. What did I try? a) referring to the svg in its original place outside WEB-INF with url(/headers/logo.svg) - context-relative, url(headers/svg), url(../../logo.svg) and so on - also with single quotes around the paths. b) Putting the graphic (an svg) in the stylesheet's directory and referring to it with url(logo.svg) c) Putting the graphic inside the package of the transforming servlet, which ends up in a jar file, and again referring with url(logo.svg) Some of these trials where really odd, I always tried to refer to the execution of my servlet as base. Please help once more - thanks!! sonja - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Message Scanned by ClamAV on datalucid.com -- Datalucid Limited Message Scanned by ClamAV on datalucid.com - 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: Font embedding again
Hi, Jeremias! Thank you for answering! Nevertheless, in my servlet, I hand over my own logger to the fop-driver Here is the normal log if I don't use special fonts or if the path to ttf is simply wrong: (this is the webapps log, since I hand over the servlets logger to the fop driver). [some logging of my Servlet code before fop comes into play] 05 08 19:56:18 INFO com.dietzk.fo.FopTransformServlet (73) - building formatting object tree 05 08 19:56:19 INFO com.dietzk.fo.FopTransformServlet (73) - [1] 05 08 19:56:19 INFO com.dietzk.fo.FopTransformServlet (73) - [2] 05 08 19:56:19 INFO com.dietzk.fo.FopTransformServlet (73) - [3] 05 08 19:56:19 INFO com.dietzk.fo.FopTransformServlet (73) - [4] 05 08 19:56:19 INFO com.dietzk.fo.FopTransformServlet (73) - [5] 05 08 19:56:19 INFO com.dietzk.fo.FopTransformServlet (73) - [6] 05 08 19:56:19 DEBUG com.dietzk.fo.FopTransformServlet (42) - Last page-sequence produced 6 pages. 05 08 19:56:19 INFO com.dietzk.fo.FopTransformServlet (73) - Parsing of document complete, stopping renderer 05 08 19:56:19 DEBUG com.dietzk.fo.FopTransformServlet (42) - Initial heap size: 5210Kb 05 08 19:56:19 DEBUG com.dietzk.fo.FopTransformServlet (42) - Current heap size: 6022Kb 05 08 19:56:19 DEBUG com.dietzk.fo.FopTransformServlet (42) - Total memory used: 812Kb 05 08 19:56:19 DEBUG com.dietzk.fo.FopTransformServlet (42) - Memory use is indicative; no GC was performed 05 08 19:56:19 DEBUG com.dietzk.fo.FopTransformServlet (42) - These figures should not be used comparatively 05 08 19:56:19 DEBUG com.dietzk.fo.FopTransformServlet (42) - Total time used: 593ms 05 08 19:56:19 DEBUG com.dietzk.fo.FopTransformServlet (42) - Pages rendered: 6 05 08 19:56:19 DEBUG com.dietzk.fo.FopTransformServlet (42) - Avg render time: 98ms/page When embedding the font, the log looks like this: [some logging of my Servlet code before fop comes into play] 06 08 08:26:17 INFO com.dietzk.fo.FopTransformServlet (73) - building formatting object tree 06 08 08:26:18 INFO com.dietzk.fo.FopTransformServlet (73) - [1] 06 08 08:26:27 INFO com.dietzk.fo.FopTransformServlet (73) - [1] nothing more. With some modifications on the paths not even the two [1] lines show up. There is no tomcat error message on the screen but simply a transparent browser tab on firefox and in IE the 404 error page. (But the webapp was found and run) In tomcat logs, I don't find any error message either. And here is the current version of fop-config.xml (I tried a lot with windows path and URI versions: font metrics-file=file://D:/Programme/Tomcat-5.5/webapps/pdfnewsletter/WEB-INF/f onts/font1.xml kerning=yes embed-file=E:\sonja\projekte\mainovaJ5\etc\fonts\Sssb.ttf font-triplet name=customFont style=normal weight=normal/ /font font metrics-file=file://D:/Programme/Tomcat-5.5/webapps/pdfnewsletter/WEB-INF/f onts/font1_b.xml kerning=yes embed-file=E:\sonja\projekte\mainovaJ5\etc\fonts\Ss__.ttf font-triplet name=customFont style=normal weight=bold/ /font No better if I change to forward slashes in the embed-file attribute. It works well with tomcat 4.1.24 under Windows. For the win/linux problem: I haven't yet tried tomcat 5.5 under Linux, only 5.0.30 ;-) If I tried even more tomcats and learn more at least for the statistics ;-), I'll write again. Thanks again! sonja -Original Message- From: Jeremias Maerki [mailto:[EMAIL PROTECTED] Sent: Freitag, 5. August 2005 21:28 To: fop-users@xmlgraphics.apache.org Subject: Re: Font embedding again Funny. Some people have no problem on Windows and when they move to Linux. Bonk! Sorry, Peter, if I had an idea about your problem I'd chime in. No Linux here to test. :-( And now you, exactly the other way around. Hmm. So, Sonja, did you check all the log output closely? Any error or warning messages you could show us? How does your userconfig.xml look like on Windows? Do you use the fontBaseDir setting? And no, it won't help if you try the code directly from Subversion. No changes in that area. On 05.08.2005 20:44:23 Sonja Löhr wrote: Hello to all! I just joined the list after one trying one day to upgrade my project. I'm using fop-20.0.5 All worked fine with font metrics and embedding with all tomcats up to 5.0.30 under Linux. Now I installed tomcat 5.5. on windows. The problem with the paths while creating the metrics - ok, that's already known. But also with my ready-to-use metrics-xmls, as soon as I add the embed-request to the fop-config.xml, I get no output and the log states that it never reaches page 2. If the font to be embedded cannot be found, I get my document out - without my font, of course. Is there some workaround or do I have to (would it help if I ) try the CVS versions of the new branch? Would be very nice to finally overcome that boring font problem. Jeremias Maerki
RE: Font embedding again
How does your userconfig.xml look like on Windows? Do you use the fontBaseDir setting? Sorry, forgot to tell you: No, I don't use a fontBaseDir. The fonts element with the contents I just posted is the only element inside configuration in fop-config.xml. Perhaps these infos are also important (but all ok with that very old tomcat): - I rebuilt FOP with an extra german hyphenation file - As already mentioned, the font metrics file(s) where created under Linux. Bye! sonja And no, it won't help if you try the code directly from Subversion. No changes in that area. On 05.08.2005 20:44:23 Sonja Löhr wrote: Hello to all! I just joined the list after one trying one day to upgrade my project. I'm using fop-20.0.5 All worked fine with font metrics and embedding with all tomcats up to 5.0.30 under Linux. Now I installed tomcat 5.5. on windows. The problem with the paths while creating the metrics - ok, that's already known. But also with my ready-to-use metrics-xmls, as soon as I add the embed-request to the fop-config.xml, I get no output and the log states that it never reaches page 2. If the font to be embedded cannot be found, I get my document out - without my font, of course. Is there some workaround or do I have to (would it help if I ) try the CVS versions of the new branch? Would be very nice to finally overcome that boring font 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]
RE: Font embedding again
Got it!! It was not the embed-file attribute, but the metrics-file attribute itself. Although I'm quite sure to have tried all numbers of slashes and backslashes, it is finally ok with: font metrics-file=file:///D:/Programme/Tomcat-5.5/webapps/pdfnewsletter/WEB-INF/ fonts/font1.xml kerning=yes embed-file=E:/sonja/projekte/mainovaJ5/etc/fonts/Ss__.ttf font-triplet name=customFont style=normal weight=normal/ /font Perhaps something was overwritten, as the attribute values are inserted via ant location properties Sorry for all the mailing and happy fopping ! sonja -Original Message- From: Jeremias Maerki [mailto:[EMAIL PROTECTED] Sent: Freitag, 5. August 2005 21:28 To: fop-users@xmlgraphics.apache.org Subject: Re: Font embedding again Funny. Some people have no problem on Windows and when they move to Linux. Bonk! Sorry, Peter, if I had an idea about your problem I'd chime in. No Linux here to test. :-( And now you, exactly the other way around. Hmm. So, Sonja, did you check all the log output closely? Any error or warning messages you could show us? How does your userconfig.xml look like on Windows? Do you use the fontBaseDir setting? And no, it won't help if you try the code directly from Subversion. No changes in that area. On 05.08.2005 20:44:23 Sonja Löhr wrote: Hello to all! I just joined the list after one trying one day to upgrade my project. I'm using fop-20.0.5 All worked fine with font metrics and embedding with all tomcats up to 5.0.30 under Linux. Now I installed tomcat 5.5. on windows. The problem with the paths while creating the metrics - ok, that's already known. But also with my ready-to-use metrics-xmls, as soon as I add the embed-request to the fop-config.xml, I get no output and the log states that it never reaches page 2. If the font to be embedded cannot be found, I get my document out - without my font, of course. Is there some workaround or do I have to (would it help if I ) try the CVS versions of the new branch? Would be very nice to finally overcome that boring font 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]