Re: representative example needed
I am new to FOP and still have not entirely gotten past the learning curve Will is referring too. But with the help of this mailing list, some online resources and an XSL-FO reference book I have successful in working FOP into one project, and have a second one nearing completion. So far the results have been very satisfactory. This is a very worth while tool to have in your IT tool box. Luke - Original Message - From: Will Gilbert [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, February 04, 2005 10:53 AM Subject: Re: representative example needed On Feb 4, 2005, at 10:33 AM, Ilya Khandamirov wrote: FOP is popular. I believe, FOP is also good. I just want to find out, how good it is. My hope is, that either the FOP team or one of the numerous happy FOP users could provide me with a representative sample. I want to chime in saying that I am a very happy FOP 'user'. But on-line examples of my work are difficult to provide as they have been setup behind corporate firewalls. Most of my FOP deployments are used to assemble reports on demand. The components of these reports are drawn from several database servers throughout the companies enterprise, built into a large XML, which is transformed to FO via an XSLT which FOP uses to produce the final PDF. This work in done as a Tomcat servlet. This process is browser driven, the end-user just clicks a link, then receives an up-to-the-minute PDF report. Most have no idea of the complexity which lies beneath, nor should they. As an outside consultant I have been able to deliver solutions using FOP which meet the clients specifications but also empowers them to enhance the delivered solution, something they really appreciate. They keep bringing me back for more and more projects, and occasionally to fix their XSLT goofs. The learning curve on XSLT/FOP may be bit steep but the payoffs are huge! --will - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Need a little help
How embarassing. That was it. Thank you all. Luke - Original Message - From: Andreas L. Delmelle [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 24, 2005 6:55 PM Subject: RE: Need a little help -Original Message- From: Glen Mazza [mailto:[EMAIL PROTECTED] I may be missing something here, but shouldn't the flow-name be xsl-region-before[1]? Nope! Dmmn' Right! :-P Good catch. Greetz, Andreas - 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]
Need a little help
Hello; I converted all the measurements into cm on my page layout. Everything looks good except that my header is no longer showing up. I am not catching any errors thrown when FOP renders the PDF. I can't figure out why it is not being shown. The image it self is at the path on the server, everything else is rendered fine, just a space where the header should be. Any help would be appreciated. Thanks, Luke fo:root xmlns:fo=http://www.w3.org/1999/XSL/Format; !-- configure the page attributes -- fo:layout-master-set fo:simple-page-master master-name=simple page-height=29.7cm page-width=21cm margin-top=1cm margin-bottom=1cm margin-left=1cm margin-right=1cm fo:region-before extent=2.47cm/ fo:region-body margin-top=2.47cm/ fo:region-after extent=2cm/ /fo:simple-page-master /fo:layout-master-set fo:page-sequence master-reference=simple !-- header -- fo:static-content flow-name=xsl-region-start fo:block fo:external-graphic src=url(file:///usr/tomcat/ac/images/topbanner/nakheel_BL_pdf_panel.gif) height=2.47cm width=20cm scaling=uniform / /fo:block /fo:static-content !-- footer -- fo:static-content flow-name=xsl-region-end fo:block font-family=Helvetica start-indent=1em font-size=8ptFooter/fo:block /fo:static-content !-- body -- fo:flow flow-name=xsl-region-body font-family=Helvetica start-indent=1em font-size=8pt !-- this template writes out all the main content, which shows up correctly-- xsl:call-template name=draw_contents/ /fo:flow /fo:page-sequence /fo:root - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Need a little help
Thanks, I added single quotes, not sure how that was overlooked. Anyway still no header. I can't help but think that this is a sizing issue. Maybe a made a mistake somewhere when converting to cm? Although everything seems to add up so I'm not sure what is going on. - Original Message - From: Andreas L. Delmelle [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 24, 2005 6:43 PM Subject: RE: Need a little help -Original Message- From: Luke Shannon [mailto:[EMAIL PROTECTED] Hi Luke, Everything looks good except that my header is no longer showing up. I am not catching any errors thrown when FOP renders the PDF. I can't figure out why it is not being shown. The cause seems to be here: fo:external-graphic src=url(file:///usr/tomcat/ac/images/topbanner/nakheel_BL_pdf_panel.gif) height=2.47cm width=20cm scaling=uniform / IIRC that should be either: src=url('file:///...') (mind the quotes!) or src=file:///... HTH! Greetz, Andreas - 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]
Mixing Units
Can problems arise from mixing units? My page is defined in cm and images in px. Thanks, Luke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Mixing Units
Thanks. This might explain what I am seeing now. - Original Message - From: The Web Maestro [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, January 21, 2005 5:18 PM Subject: Re: Mixing Units On Jan 21, 2005, at 2:10 PM, Luke Shannon wrote: Can problems arise from mixing units? My page is defined in cm and images in px. Thanks, Luke It should not be a problem to mix units. However, I've seen a number of times recently when FOP developers indicate that pictures should never be defined using 'px'. Rather they should be defined using 'cm', 'mm', 'in'. I believe the thinking is something to the effect of: 'px' is resolution dependent, whereas 'cm', 'mm', 'in' are not. Web Maestro Clay -- [EMAIL PROTECTED] - http://homepage.mac.com/webmaestro/ My religion is simple. My religion is kindness. - HH The 14th Dalai Lama of Tibet - 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]
tidy error
Hello; If this is not an appropriate forum for this please let me know. I would like to use tidy to clean up some input before I render my document with FOP. I am getting the following error: org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:307) Anyone seen this before? Below is the code for anyone that is interested. Thanks, Luke private String htmlTidy(String html) { try { StringBufferInputStream sbis=new StringBufferInputStream(html); ByteArrayOutputStream baos=new ByteArrayOutputStream(); Tidy tidy = new Tidy(); Trace.ENTER(FOP PDF: Tidy object created.); //configure tidy tidy.setQuiet(true); tidy.setShowWarnings(false); tidy.setXmlOut(false); tidy.setXHTML(true); tidy.setMakeClean(false); tidy.setTidyMark(false); tidy.setUpperCaseTags(false); tidy.setUpperCaseAttrs(false); tidy.setQuoteAmpersand(false); tidy.setNumEntities(true); tidy.setCharEncoding(Configuration.UTF8); Trace.ENTER(FOP PDF: Tidy object configured.); tidy.parse(sbis,baos); Trace.ENTER(FOP PDF: Tidy parsing complete.); html = baos.toString(); } catch (Exception e) { Trace.ENTER(FOP PDF: TIDY ERROR! + e); } return html; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Query
Hi Amit; I am also a newbie. I can tell you that a good place to start is the examples section that comes with the FOP download. Specifically the example ExampleXML2FO.java (fop-0.20.5\examples\embedding\java\embedding). Hope that helps, Luke - Original Message - From: Amit Chawla To: [EMAIL PROTECTED] Sent: Wednesday, January 19, 2005 2:01 PM Subject: Query Hi All, I am a newbie to FOP and XML... I need to ask you guys that how to generate XSL for the XML created at run time. and then to create XSL-FO at run time and then to pass it FOP and generate PDF.. If anybody could help me that will be gr8.. thanks in advance rgds amit
Re: Query
I see. I am doing something similar. However, the XSL exists for me. I run this, getting an FO document in string form back. This string contains some HTML within the FO document, which needs to be further convert to FO objects (it is this department I am having my own trouble with). I tried to convert the HTML to FO in the XSL but was unsuccessful. I currently replace certain HTML tags with FO tags and strip the rest in java before I render with FOP. I would like to get Tidy involved at this point but I am getting some errors I have been unable to resolve. I suppose you could do something similar to me in which you looks for specific html tags and replace them with FO tags that perform the same function. Something like digester would allow you to parse the XML getting the contents of the nodes your are interested in. You could then sub out the tags and produce an FO document in memory that could be passed to FOP to generate your document. Honestly though, I'm not the best person to advise you since I have yet to get my own solution working and am not yet very strong in XSL. Luke - Original Message - From: Amit Chawla [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, January 19, 2005 2:19 PM Subject: RE: Query Hi Luke, Thanks for the email reply.. actually i have seen that and what i have understood from it i require XSL file which will transform the xml to XSL-FO... and what is happening in my requirement is that i have to generate HTML at run time and then convert this HTML doc using TIdy to XML/XHTML and then use this to generate PDF I was facing problem with ITEXT as they dont support all the HTML tags and for generating PDF i had to write HTMLparser which i have done and am successful to generate PDF .. ... but the problem is that i am using FCKeditor as my internet editor where i can do formatting of text just like word doc... and it returns me string of html elements .. I have used this string to generate HTML doc and then xml. FCKeditor generates tags and there attributes which are not supported in ITEXT and i have to handle them in my HTML parser. I will lose format of text in my PDF as i am not aware what all tags and attributes FCKeditor will generate at run time.. So i decided to shift to FOP . hoping that it would suffice my needs ... so my situation is i have to parse this xml document which is generated at run time and i feel/think i will require to generate XSL at run time and then using the example i can generate XSL-FO and then set up driver of fop to generate PDF using FOP... Here i m stuck as i am not getting a way to generate XSL at run time... all help appreciated thanks for reply again. regards amit _ From: Luke Shannon [mailto:[EMAIL PROTECTED] Sent: Thu 1/20/2005 12:38 AM To: [EMAIL PROTECTED] Subject: Re: Query Hi Amit; I am also a newbie. I can tell you that a good place to start is the examples section that comes with the FOP download. Specifically the example ExampleXML2FO.java (fop-0.20.5\examples\embedding\java\embedding). Hope that helps, Luke - Original Message - From: Amit Chawla mailto:[EMAIL PROTECTED] To: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Sent: Wednesday, January 19, 2005 2:01 PM Subject: Query Hi All, I am a newbie to FOP and XML... I need to ask you guys that how to generate XSL for the XML created at run time. and then to create XSL-FO at run time and then to pass it FOP and generate PDF.. If anybody could help me that will be gr8.. thanks in advance rgds amit - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Image Resolution
If I specify one of the dimensions of an external image should this not ensure that the resolution used in the PDF will be the same as the orginal? I am trying to use a hi rez image as my header, however it looks like it is being written as 72dpi in the document, even though I specify the width. Below is my code. The FAQ page contains the following quote: The explanation above describes only the basic default behavior. There are other attributes of the fo:external-graphic element that can affect the behavior described above. Is there more details on this somewhere? Thanks, Luke fo:block fo:external-graphic src=url(file:///usr/tomcat/ac/images/topbanner/nakheel_BL_pdf_panel.gif) width=1125px scaling=uniform/ /fo:block - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Image Resolution
The shrinking idea is a good one. I'll give that a try. Thanks, Luke - Original Message - From: The Web Maestro [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, January 19, 2005 2:55 PM Subject: Re: Image Resolution Luke, Resolution is a tough nut. You can find more info on the FOP Graphics page[1]. A couple of patient people have done tons of testing, which you can find in the archives from a year or two ago. The way I got high quality was to create a 300dpi logo image that was larger than I needed, then specified width height attributes that required the image shrink to fit. It's not an exact science, unfortunately. [1] http://xml.apache.org/fop/graphics.html On Jan 19, 2005, at 11:50 AM, Luke Shannon wrote: If I specify one of the dimensions of an external image should this not ensure that the resolution used in the PDF will be the same as the orginal? I am trying to use a hi rez image as my header, however it looks like it is being written as 72dpi in the document, even though I specify the width. Below is my code. The FAQ page contains the following quote: The explanation above describes only the basic default behavior. There are other attributes of the fo:external-graphic element that can affect the behavior described above. Is there more details on this somewhere? Thanks, Luke fo:block fo:external-graphic src=url(file:///usr/tomcat/ac/images/topbanner/ nakheel_BL_pdf_panel.gif) width=1125px scaling=uniform/ /fo:block - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Web Maestro Clay -- [EMAIL PROTECTED] - http://homepage.mac.com/webmaestro/ My religion is simple. My religion is kindness. - HH The 14th Dalai Lama of Tibet - 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: Positioning The Header
That worked. Thank you. - Original Message - From: The Web Maestro [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 17, 2005 6:38 PM Subject: Re: Positioning The Header On Jan 17, 2005, at 2:28 PM, Luke Shannon wrote: Hello; I am playing with the extent values, space-after, etc. However I can't seem to space the region-before and region-body out enough to prevent the header image from over lapping the region-body content. Below is my code. I would love any tips anyone might have. Note: The image height is 2.47cm. Template draw_contents writes out the body. Wouldn't it just be: [..] fo:region-before extent=2.47cm/ fo:region-body margin-top=2.47cm/ [..] Web Maestro Clay -- [EMAIL PROTECTED] - http://homepage.mac.com/webmaestro/ My religion is simple. My religion is kindness. - HH The 14th Dalai Lama of Tibet - 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]
Centralizing Fonts
Hello; I have looked around for examples of this but have not found anything. Is there a way to define all the attributes (font-family, start-indent, etc) for fo:block used in the document? Thanks, Luke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Centralizing Fonts
Sorry, replying to my own post. fo:flow flow-name=xsl-region-body font-family=Helvetica start-indent=1em font-size=12pt There were a bunch of block in the document had font-family Arial, which doesn't exist, so a default font was being displayed making me think that the above wasn't working. - Original Message - From: Luke Shannon [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 18, 2005 3:26 PM Subject: Centralizing Fonts Hello; I have looked around for examples of this but have not found anything. Is there a way to define all the attributes (font-family, start-indent, etc) for fo:block used in the document? Thanks, Luke - 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: Centralizing Fonts
Hah hah. Just like that. Thanks! - Original Message - From: The Web Maestro [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 18, 2005 3:39 PM Subject: Re: Centralizing Fonts On Jan 18, 2005, at 12:26 PM, Luke Shannon wrote: Hello; I have looked around for examples of this but have not found anything. Is there a way to define all the attributes (font-family, start-indent, etc) for fo:block used in the document? Thanks, Luke You mean like this? :-p xsl:attribute-set name=attributes_GLOBAL !-- background-color for overall EOR page - default:#ff (white) -- xsl:attribute name=background-color#ff/xsl:attribute !-- color for text - default:#00 (black) -- xsl:attribute name=color#00/xsl:attribute !-- font-family for text - default:courier new, courier, monospace -- xsl:attribute name=font-familycourier new, courier, monospace/xsl:attribute !-- NOTE: Changes to font-family affects FOP rendering of EOR and may require overhaul of template! -- !-- font-size for text - default:8pt - -- xsl:attribute name=font-size8pt/xsl:attribute !-- NOTE: Changes to font-size DRASTICALLY affects FOP rendering of EOR and may require COMPLETE overhaul of template! -- /xsl:attribute-set fo:page-sequence master-reference=repeating force-page-count=no-force fo:static-content flow-name=xsl-region-before fo:block padding=0pt xsl:use-attribute-sets=attributes_GLOBAL xsl:call-template name=tmpHeader/ /fo:block /fo:static-content fo:static-content flow-name=xsl-region-after fo:block xsl:use-attribute-sets=attributes_GLOBAL xsl:call-template name=tmpFooter/ /fo:block /fo:static-content fo:flow flow-name=xsl-region-body fo:block xsl:use-attribute-sets=attributes_GLOBAL xsl:call-template name=tmpBody/ fo:block padding=0pt font-size=1pt fo:marker marker-class-name=table-continued/ /fo:block /fo:block /fo:flow /fo:page-sequence Web Maestro Clay -- [EMAIL PROTECTED] - http://homepage.mac.com/webmaestro/ My religion is simple. My religion is kindness. - HH The 14th Dalai Lama of Tibet - 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]
Header
Hello; Should this not give me an image before the body area? fo:static-content flow-name=xsl-region-before fo:block fo:external-graphic src=url('//usr/tomcat/ac/images/topbanner/mainlogo.gif')/ /fo:block /fo:static-content Thanks, Luke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Header
Yes. I want to path to image started at the root directory (UNIX environment). There is an image at that location so I will try playing with attributes you mentioned because right now the image is not showing up. Thanks, Luke - Original Message - From: The Web Maestro [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 17, 2005 3:17 PM Subject: Re: Header Probably, assuming there is an image at that location. However for that to work, you probably need to give fo:region-before/fo:region-body attributes (extent= / margin-top= respectively) greater than or equal to the fo:external-graphic. BTW, I notice that there are two '//' in the @src. Is that intended? Web Maestro Clay On Jan 17, 2005, at 12:15 PM, Luke Shannon wrote: Hello; Should this not give me an image before the body area? fo:static-content flow-name=xsl-region-before fo:block fo:external-graphic src=url('//usr/tomcat/ac/images/topbanner/mainlogo.gif')/ /fo:block /fo:static-content Thanks, Luke Web Maestro Clay -- [EMAIL PROTECTED] - http://homepage.mac.com/webmaestro/ My religion is simple. My religion is kindness. - HH The 14th Dalai Lama of Tibet - 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: Header
You are correct I was missing the file:// . Thanks, Luke - Original Message - From: Andreas L. Delmelle [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 17, 2005 3:37 PM Subject: RE: Header -Original Message- From: The Web Maestro [mailto:[EMAIL PROTECTED] Hi Luke / Clay, Probably, assuming there is an image at that location. Look at it this way: what location? (see below) fo:external-graphic src=url('//usr/tomcat/ac/images/topbanner/mainlogo.gif')/ http:// ? ftp:// ? file:// ? Greetz, Andreas - 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]
Positioning The Header
Hello; I am playing with the extent values, space-after, etc. However I can't seem to space the region-before and region-body out enough to prevent the header image from over lapping the region-body content. Below is my code. I would love any tips anyone might have. Note: The image height is 2.47cm. Template draw_contents writes out the body. Thanks, Luke fo:root xmlns:fo=http://www.w3.org/1999/XSL/Format; !-- configure the page attributes -- fo:layout-master-set fo:simple-page-master master-name=simple page-height=29.7cm page-width=21cm margin-top=1cm margin-bottom=2cm margin-left=2.5cm margin-right=2.5cm fo:region-before extent=3.5cm/ fo:region-body margin-top=2cm/ fo:region-after extent=1.5cm/ /fo:simple-page-master /fo:layout-master-set !-- ouput the content -- fo:page-sequence master-reference=simple fo:static-content flow-name=xsl-region-before fo:block fo:external-graphic src=url(file:///usr/tomcat/ac/images/topbanner/mainlogo.gif) space-after=1cm/ /fo:block /fo:static-content xsl:call-template name=draw_contents/ /fo:page-sequence /fo:root - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Input Question
Hello; My current system runs a XSL to create an FO document in memory. This is what I submit to FOP to render with. The issue I am dealing with is sometime content inserted into the FO document by the XSL contains HTML. Right now I strip out all HTML before submitting the content to FOP. But the HTML contains some formatting instructions that I am sure someone is going to want to see in the PDF (font size, bolding, list, etc). My solution to this now would be to handle each formatting html tag separately (I would have a defined list to deal with, all other would be stripped), finding it in the input and replacing it with an FO tag that would perform the same operation. Is there any easier way? Thanks, Luke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Input Question
Thanks for all the help over the last week. I just gave a small demo of the PDF rendering feature of the site and it looked good. Some formating issues to resolve but the framework is in place. Luke - Original Message - From: The Web Maestro [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, January 14, 2005 3:16 PM Subject: Re: Input Question On Jan 14, 2005, at 12:04 PM, Luke Shannon wrote: snip The issue I am dealing with is sometime content inserted into the FO document by the XSL contains HTML. This is primarily an XSL question (or rather XSL solutions abound to help you resolve this). If you look on Dave Pawson's excellent XSL FAQ page[1], you might even find some xsl:template examples to get you going. Check out some of the XSL resources on the FOP Resources page[2] for more info. That said, you'll probably want to create XSL templates for the attributes you care about, so you can use XSL to convert font-size, bold, list, etc. into their fo:block @.. equivalents: e.g., btext-content/b = fo:inline font-weight=boldtext-content/fo:inline [1] http://www.dpawson.co.uk/xsl/sect3/index.html [2] http://xml.apache.org/fop/resources.html Web Maestro Clay -- [EMAIL PROTECTED] - http://homepage.mac.com/webmaestro/ My religion is simple. My religion is kindness. - HH The 14th Dalai Lama of Tibet - 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]
Trouble Shooting Tables
I have several complex layouts that are table based. Right now a few on them don't produce the desired output. There are no errors. I can only assume that there are problems in my table structure. Are there any tricks or tips anyone can offer for working through table related issues? Thanks, Luke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Table Cell Question
Sorry if it seems I am flooding the list with questions. I am new to this technology and trying to meet a deadline on a project . Any help is appreciated: I have this table: xsl:template name=s6_pdf fo:flow flow-name=xsl-region-body fo:block fo:table table-layout=fixed width=100% fo:table-column column-width=proportional-column-width(1)/ fo:table-column column-width=proportional-column-width(1)/ fo:table-body fo:table-row fo:table-cell fo:block xsl:call-template name=image_display_and_upload xsl:with-param name=imagenode select=. / xsl:with-param name=image_number select=number('3') / /xsl:call-template /fo:block fo:block xsl:call-template name=image_display_and_upload xsl:with-param name=imagenode select=. / xsl:with-param name=image_number select=number('4') / /xsl:call-template /fo:block /fo:table-cell fo:table-cell fo:block font-family=Arial font-size=12pt font-weight=normal break-after=auto space-after=10pt text-align=left xsl:call-template name=text_display_and_edit xsl:with-param name=text_number select=number('1') / /xsl:call-template /fo:block fo:block font-family=Arial font-size=12pt font-weight=normal break-after=auto space-after=10pt text-align=left xsl:call-template name=text_display_and_edit xsl:with-param name=text_number select=number('2') / /xsl:call-template /fo:block /fo:table-cell /fo:table-row /fo:table-body /fo:table /fo:block /fo:flow /xsl:template The second block in the second row is not getting written out. Even if I make it the only block of that cell, nothing gets written out. However, if I try and write the first block twice I am succesfully: fo:table-cell fo:block font-family=Arial font-size=12pt font-weight=normal break-after=auto space-after=10pt text-align=left xsl:call-template name=text_display_and_edit xsl:with-param name=text_number select=number('1') / /xsl:call-template /fo:block fo:block font-family=Arial font-size=12pt font-weight=normal break-after=auto space-after=10pt text-align=left xsl:call-template name=text_display_and_edit xsl:with-param name=text_number select=number('1') / /xsl:call-template /fo:block /fo:table-cell This works. Both block are written out. It seems the issue is related to the size of the content. Text_number 2 contains a long column of text. What can I do to resolve this? Thanks, Luke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Table Cell Question
I have verified that the template is producing an output. As a test I put putting a much short value in the place of the longer one I was trying to write. This works. It just won't produce an output of the longer value. Any ideas? Thanks, Luke - Original Message - From: J.Pietschmann [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, January 13, 2005 3:56 PM Subject: Re: Table Cell Question Luke Shannon wrote: The second block in the second row is not getting written out. Even if I make it the only block of that cell, nothing gets written out. Guess: The call-template doesn't produce anything. Generate a FO file http://xml.apache.org/fop/running.html#check-input and check whether the expected content is there. 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: Table Cell Question
I may have found the problem. The inputs causing problem are coming in from IE. When the user inputs data from IE it is done in a text tool that surrounds paragraphs in p tags. It seems the content being sent in the block is in HTML tags. If I take the pages out this are fine. Anyone know an easy way to strip out HTML tags? Luke - Original Message - From: Luke Shannon [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, January 13, 2005 4:10 PM Subject: Re: Table Cell Question I have verified that the template is producing an output. As a test I put putting a much short value in the place of the longer one I was trying to write. This works. It just won't produce an output of the longer value. Any ideas? Thanks, Luke - Original Message - From: J.Pietschmann [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, January 13, 2005 3:56 PM Subject: Re: Table Cell Question Luke Shannon wrote: The second block in the second row is not getting written out. Even if I make it the only block of that cell, nothing gets written out. Guess: The call-template doesn't produce anything. Generate a FO file http://xml.apache.org/fop/running.html#check-input and check whether the expected content is there. 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Declaring an entity for FOP to see
Hello Everyone; I am getting the following error: org.apache.fop.apps.FOPException: The entity nbsp was referenced, but not declared The strange thing is I have this tag at the start of the xml document that supplies the input to FOP: ?xml version=1.0? !DOCTYPE xsl:stylesheet [ !ENTITY nbsp '#160;' ] Should that not handle this? I can see the input being passed still contains nbsp, not sure why. Thanks, Luke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
html processesor
I am looking at cleaning up my input. I have seen Tidy and JTidy. I am missing any? Which is the easiest to implement? Thanks, Luke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html processesor
I am going with JTidy. I was looking for something I could easily drop into an existing Java class without having to import too many classes or set up a bunch of configuration files. JTidy seems to be the one. Thanks, Luke - Original Message - From: J.Pietschmann [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, January 12, 2005 5:01 PM Subject: Re: html processesor Luke Shannon wrote: I am looking at cleaning up my input. I have seen Tidy and JTidy. I am missing any? Which is the easiest to implement? What do you mean with implement and easy? JTidy has a Java API, tidy is an executable which is fast and easy to use from the command line. 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: Declaring an entity for FOP to see
My xsl is a style sheet as well: ?xml version=1.0? !DOCTYPE xsl:stylesheet [ !ENTITY nbsp '#160;' ] xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform; xmlns:msxsl=urn:schemas-microsoft-com:xslt xmlns:fo=http://www.w3.org/1999/XSL/Format; exclude-result-prefixes=fo As for the input comment, sorry for not being clearer about this. Basically the java program I am working with has a method to process an XSL file (the same one I am declaring the entity in above). It returns a string containing all the output from the XSL. It is this string that I am using to create my input source for FOP. At present FOP is throwing exceptions because of bad html or undeclared entities. As it turns out nbsp was not the only concern. The string I receive back also contains div tags which are missing the quotes around the names of style classes they are applying. I was thinking tidy would be the best way to resolve these issues once and for all. Thanks, Luke - Original Message - From: J.Pietschmann [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, January 12, 2005 4:57 PM Subject: Re: Declaring an entity for FOP to see Luke Shannon wrote: org.apache.fop.apps.FOPException: The entity nbsp was referenced, but not declared The strange thing is I have this tag at the start of the xml document that supplies the input to FOP: ?xml version=1.0? !DOCTYPE xsl:stylesheet [ !ENTITY nbsp '#160;' ] If this is a the beginning of the XML source rather than the style sheet, it's of no use (unless your XML source is a style sheet too). Should that not handle this? I can see the input being passed still contains nbsp, not sure why. I have no idea what you mean here. What input passed to whom? 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: Declaring an entity for FOP to see
This is helpful. Thank you. - Original Message - From: Web Maestro Clay [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, January 12, 2005 5:17 PM Subject: Re: Declaring an entity for FOP to see I suspect it's because you've begin the ENTITY declaration with '!DOCTYPE xsl:stylesheet [...' I think you should be able to do this: ?xml version=1.0? !DOCTYPE stylesheet [ !ENTITY nbsp '#160;' ] (but I don't know) This is probably the best thing to see: http://www.dpawson.co.uk/xsl/sect2/N3573.html If you're into the learning thing, you can find a separate example here (look for ntilde;) although I think Dave Pawson's link above is your best bet: http://www.xml.com/pub/a/2001/03/14/trxml10.html Rather than fighting with this, I ended up just changing all of my nbsp; entities (and any other weird entitites) to their numeric counterparts (e.g., #160;) which is essentially what Dave Pawson recommends anyway. - 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]
Image Output issues
Hello; I am trying to dynamically create the path to my image file. I'm getting the error: org.apache.fop.apps.FOPException: The entity acirc was referenced, but not declared. I am not sure what acirc is? Here is the code(this is not the full path, i am trying to incrementally building while outputting the results): The template that will return the path: xsl:template name=image_display_and_upload xsl:param name=IP select=string($IP)/ xsl:param name=current select=string(.)/ xsl:value-of select=concat($IP, $current)/ /xsl:template The template outputting the FO: fo:table-row !-- image cell -- fo:table-cell number-columns-spanned=2 fo:block xsl:variable name=filePath xsl:call-template name=image_display_and_upload/ /xsl:variable xsl:value-of select=$filePath/ !--fo:external-graphic src=url(file://{$IP}{./@PATH}{./@FNAME}/{./DATA/VERSION/[EMAIL PROTECTED] me]/@DIR150DPI})/-- /fo:block /fo:table-cell /fo:table-row fo:table-row Any help would be greatly appreciated. Thanks, Luke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Image Output issues
It is intentional. The variable in the url parameter are not visible from the document I am running this in. I need to calculate the path to the image in another lever and pass it back to this function. Once I can see that I have the whole path outputting correctly I can uncomment my graphics tag, drop in the variable containing the path and finally see this working the way it should. I may throw a little party in my cube to celebrate. :-) Thanks for the explanation of arirc. What still confuses me is I am not doing anything with the image file yet. So far I'm trying to concatenate the IP and along with the name of the current node into a variable and than write this into the document. Where is it getting the arirc I wonder? Thanks, Luke - Original Message - From: The Web Maestro [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 11, 2005 11:56 AM Subject: Re: Image Output issues Luke, The acirc entity is an 'a' with a ^ above it[1]. I suspect the binary image file is being read as text, and it happens to be the first 'bad' character the XML parser is seeing. That said, I notice you've got the fo:external-graphic.. element commented out. Is that intended? [1] http://www.uspto.gov/web/offices/ac/ido/oeip/sgml/st32/redbook/pap- v15-2001-01-31/entities/acirc.html On Jan 11, 2005, at 8:45 AM, Luke Shannon wrote: Hello; I am trying to dynamically create the path to my image file. I'm getting the error: org.apache.fop.apps.FOPException: The entity acirc was referenced, but not declared. I am not sure what acirc is? Here is the code(this is not the full path, i am trying to incrementally building while outputting the results): The template that will return the path: xsl:template name=image_display_and_upload xsl:param name=IP select=string($IP)/ xsl:param name=current select=string(.)/ xsl:value-of select=concat($IP, $current)/ /xsl:template The template outputting the FO: fo:table-row !-- image cell -- fo:table-cell number-columns-spanned=2 fo:block xsl:variable name=filePath xsl:call-template name=image_display_and_upload/ /xsl:variable xsl:value-of select=$filePath/ !--fo:external-graphic src=url(file://{$IP}{./@PATH}{./@FNAME}/{./DATA/VERSION/ [EMAIL PROTECTED] me]/@DIR150DPI})/-- /fo:block /fo:table-cell /fo:table-row fo:table-row Any help would be greatly appreciated. Thanks, Luke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Web Maestro Clay -- [EMAIL PROTECTED] - http://homepage.mac.com/webmaestro/ My religion is simple. My religion is kindness. - HH The 14th Dalai Lama of Tibet - 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]
Table Help
Hello; I am looking for one column that only contains an image, next to it a column with 2 cells stack on top of one another. What I get with the code below is the image and only the first cell in the second row? Any ideas? Does anyone know a good online tutorial for figuring out tables? Luke xsl:template name=s2_pdf xsl:param name=imagename select=concat(string('IMAGE'),number('1')) / !-- text 1 -- fo:flow flow-name=xsl-region-body fo:table inline-progression-dimension=100% table-layout=fixed fo:table-column column-width=50% number-columns-repeated=2/ fo:table-body fo:table-row !-- image cell -- fo:table-cell number-rows-spanned=2 fo:block xsl:call-template name=image_display_and_upload xsl:with-param name=imagenode select=. / /xsl:call-template /fo:block /fo:table-cell /fo:table-row fo:table-row !-- text number one cell -- fo:table-cell fo:block font-family=Arial font-size=12pt font-weight=bold break-after=auto space-after=10pt text-align=left xsl:call-template name=text_display_and_edit xsl:with-param name=text_number select=number('1') / /xsl:call-template /fo:block /fo:table-cell !-- text number two cell -- fo:table-cell fo:block font-family=Arial font-size=12pt font-weight=bold break-after=auto space-after=10pt text-align=left xsl:call-template name=text_display_and_edit xsl:with-param name=text_number select=number('2') / /xsl:call-template /fo:block /fo:table-cell /fo:table-row /fo:table-body /fo:table /fo:flow /xsl:template - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Table Help
Hello Web Maestro Clay; Thanks for your help up to this point. It is appreciated. What I don't understand is the relationship between columns and tables. The fact that you list the columns and than in the body the rows is confusing, and the fact that there are no errors, only a blank page when I make a mistake with my table is a little frustrating. If there is one column and 2 rows, each with a cell, would it not just write one row on top of the other in the column? So if there is 2 columns and and 2 rows with 2 cells would it not write one cell into each column, with row one appearing above row two? Thanks, Luke - Original Message - From: The Web Maestro [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 11, 2005 2:41 PM Subject: Re: Table Help On Jan 11, 2005, at 11:38 AM, Luke Shannon wrote: Hello; I am looking for one column that only contains an image, next to it a column with 2 cells stack on top of one another. What I get with the code below is the image and only the first cell in the second row? Any ideas? Does anyone know a good online tutorial for figuring out tables? I'd say check out the examples/ directory in the FOP distribution you downloaded. Luke xsl:template name=s2_pdf xsl:param name=imagename select=concat(string('IMAGE'),number('1')) / !-- text 1 -- fo:flow flow-name=xsl-region-body fo:table inline-progression-dimension=100% table-layout=fixed fo:table-column column-width=50% number-columns-repeated=2/ never saw the number-columns-repeated attribute. Try this (from [1]): fo:table table-layout=fixed width=100% fo:table-column column-width=proportional-column-width(1)/ fo:table-column column-width=proportional-column-width(1)/ fo:table-body fo:table-row fo:table-cell fo:blockfoo/fo:block /fo:table-cell fo:table-cell fo:blockbar/fo:block /fo:table-cell /fo:table-row /fo:table-body /fo:table [1] http://xml.apache.org/fop/fo.html#fo-center-table-horizon fo:table-body fo:table-row !-- image cell -- fo:table-cell number-rows-spanned=2 fo:block xsl:call-template name=image_display_and_upload xsl:with-param name=imagenode select=. / /xsl:call-template /fo:block /fo:table-cell /fo:table-row fo:table-row !-- text number one cell -- fo:table-cell fo:block font-family=Arial font-size=12pt font-weight=bold break-after=auto space-after=10pt text-align=left xsl:call-template name=text_display_and_edit xsl:with-param name=text_number select=number('1') / /xsl:call-template /fo:block /fo:table-cell !-- text number two cell -- fo:table-cell fo:block font-family=Arial font-size=12pt font-weight=bold break-after=auto space-after=10pt text-align=left xsl:call-template name=text_display_and_edit xsl:with-param name=text_number select=number('2') / /xsl:call-template /fo:block /fo:table-cell /fo:table-row /fo:table-body /fo:table /fo:flow /xsl:template - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Web Maestro Clay -- [EMAIL PROTECTED] - http://homepage.mac.com/webmaestro/ My religion is simple. My religion is kindness. - HH The 14th Dalai Lama of Tibet - 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: Table Help
Thank you Jay. This helps a lot. - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 11, 2005 3:50 PM Subject: Re: Table Help What I don't understand is the relationship between columns and tables. Well, the fo:table element requires one or more fo:table-column elements as children. In other words, you have to remember that XSL:FO requires you to specify the columns before you specify the table body. When you start specifying cells, FOP requires that each row have the same number of cells as the table has columns (though you can have one column span cells). Other processors might permit an empty cell, but FOP does no thinking for you, so it requires that you spell out everything. In the following simple example, notice that the table-column elements and the table-body element are the immediate descendents (the children) of the table element. The rows and cells are and must be, because table-body has to contain them, deeper descendents (grandchildren and great-grandchildren, as it were). fo:table table-layout=fixed fo:table-column column-width=2in/ fo:table-column column-width=2.5in/ fo:table-column column-width=2in/ fo:table-body fo:table-row fo:table-cell fo:block xsl:use-attribute-sets=footerleft Date prepared: xsl:value-of select=format-date(current-date(),'[D1] [MNn] [Y0001]')/ /fo:block /fo:table-cell fo:table-cell fo:block xsl:use-attribute-sets=footercenter Confidential and Proprietary /fo:block /fo:table-cell fo:table-cell fo:block xsl:use-attribute-sets=footerright fo:page-number/ /fo:block /fo:table-cell /fo:table-row /fo:table-body /fo:table HTH Jay Bryant Bryant Communication Services (on contract at Syngeristic Solution Technologies) - 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]
HR in FOP
Is create draw a line on the page? Thanks, Luke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HR in FOP
Thank you. I will look into those reference books as well. Luke - Original Message - From: The Web Maestro [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 11, 2005 5:32 PM Subject: Re: HR in FOP Here are a couple of options: fo:table-row border-bottom=1pt solid #00 fo:block border-bottom=1pt solid #00/ fo:external-graphic src=url('blackline.gif') width=aswideasthepagecm height=notveryhighcm/ Some good XSL-FO references (books and online too!) are available on the FOP Resources page[1]. On Jan 11, 2005, at 2:17 PM, Luke Shannon wrote: Is create draw a line on the page? Thanks, Luke Cheers! [1] http://xml.apache.org/fop/resources.html#documents Web Maestro Clay -- [EMAIL PROTECTED] - http://homepage.mac.com/webmaestro/ My religion is simple. My religion is kindness. - HH The 14th Dalai Lama of Tibet - 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: HR in FOP
Cool! Thanks. - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 11, 2005 5:54 PM Subject: Re: HR in FOP Assuming you have one-inch margins and a page with of 8.5 inches, the following FO element draws a one-point black line across the page: fo:leader leader-pattern=rule rule-thickness=1.0pt leader-length=6.5in color=black/ You can also set other properties, such as space-before and space-after. Here's an example that I use for lines in footers (to separate the rest of the page from the footer): At the top of the stylesheet, I have a bunch of elements similar to this one: xsl:attribute-set name=footerleader xsl:attribute name=leader-patternrule/xsl:attribute xsl:attribute name=rule-thickness1.0pt/xsl:attribute xsl:attribute name=leader-length6.5in/xsl:attribute xsl:attribute name=space-before.optimum0pt/xsl:attribute xsl:attribute name=space-after.optimum24pt/xsl:attribute xsl:attribute name=colorblack/xsl:attribute /xsl:attribute-set That way, I can maintain styles in one place within the stylesheet (and I could maintain them in a separate file and import them, if need be). Later, when I actually want a line across the page, I then use: fo:leader xsl:use-attribute-sets=footerleader/ You do not need to use one-cell tables and external graphics to get a simple (or not-s-simple) line. HTH Jay Bryant Bryant Communication Services (on contract at Synergistic Solution Technologies) - 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: Unbound Error
You are correct. Thanks, Luke - Original Message - From: Chris Bowditch [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 10, 2005 5:44 AM Subject: Re: Unbound Error Luke Shannon wrote: Hello Andreas; This is the nature of my problem. The block lies outside of the root. It is in a template. I start in root, write some generic stuff and than depending on the params jump of the one of several templates to write out the content. Each template needs to contains its own formatting schema. I was hoping to do this by embedding the content in a fo block. If this is allowed, do I have any other options? I would like to avoid complicating the root template with 13 different output options. I think you just need to define the fo namespace at the top of your xsl:stylesheet, e.g. xsl:stylesheet xmlns:fo=http://www.w3.org/1999/XSL/Format; xsl:template match=/ fo:root ... /fo:root /xsl:template ... /xsl:stylesheet snip/ Chris - 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]
Document Questions
Hello; I am working on creating all the various layouts our product supports in FO. Having some issues. The code below runs when it is time to get the FO input: !-- fo root: all document properties go inside this tag -- fo:root xmlns:fo=http://www.w3.org/1999/XSL/Format; !-- configure the page attributes -- fo:layout-master-set fo:simple-page-master master-name=simple 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-top=3cm/ fo:region-before extent=3cm/ fo:region-after extent=1.5cm/ /fo:simple-page-master /fo:layout-master-set !-- ouput the content -- fo:page-sequence master-reference=simple xsl:call-template name=s2_pdf / /fo:page-sequence /fo:root Here is the template it calls: xsl:template name=s2_pdf fo:flow flow-name=xsl-region-start fo:block IMG SRC={$spacepath} WIDTH=9 HEIGHT=1 / /fo:block /fo:flow fo:flow flow-name=xsl-region-body !-- text 1 -- fo:block font-family=Arial font-size=12pt font-weight=bold break-after=auto space-after=10pt text-align=left xsl:call-template name=text_display_and_edit xsl:with-param name=text_number select=number('1') / xsl:with-param name=text_firstname select=string('TEXT') / xsl:with-param name=texttype select=string('norich') / /xsl:call-template /fo:block !-- text 2 -- fo:block font-family=Arial font-size=12pt font-weight=normal text-align=left xsl:call-template name=text_display_and_edit xsl:with-param name=text_number select=number('2') / xsl:with-param name=text_firstname select=string('TEXT') / xsl:with-param name=texttype select=string('norich') / /xsl:call-template /fo:block /fo:flow I have 2 problems. 1. With the image tag the way that it is, I get an error claiming the tag needs an accompaning /img. This is confusing to me because the tag above contains a /. 2. If I take the image tag out I get a message complaining about more than one flow in a page sequence. How else can I write to different xsl: regions of the same page? Should I just use tables for this? Thanks, Luke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Document Questions
Hi; I have scrapped the code I originally posted in favour of tables. My code runs without error now, but the document is blank? Any tips would be appreciated: Code starts here: !-- fo root: all document properties go inside this tag -- fo:root xmlns:fo=http://www.w3.org/1999/XSL/Format; !-- configure the page attributes -- fo:layout-master-set fo:simple-page-master master-name=simple 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-top=3cm/ fo:region-before extent=3cm/ fo:region-after extent=1.5cm/ /fo:simple-page-master /fo:layout-master-set !-- ouput the content -- fo:page-sequence master-reference=simple xsl:call-template name=s2_pdf / /fo:page-sequence /fo:root Template Defined Here: xsl:template name=s2_pdf fo:flow flow-name=xsl-region-body fo:table fo:table-body fo:table-row !-- image cell -- fo:table-cell number-columns-spanned=2 fo:block fo:external-graphic src=url({$spacepath})/ /fo:block /fo:table-cell /fo:table-row fo:table-row !-- text number one cell -- fo:table-cell fo:block font-family=Arial font-size=12pt font-weight=bold break-after=auto space-after=10pt text-align=left xsl:call-template name=text_display_and_edit xsl:with-param name=text_number select=number('1') / xsl:with-param name=text_firstname select=string('TEXT') / xsl:with-param name=texttype select=string('norich') / /xsl:call-template /fo:block /fo:table-cell !-- text number two cell -- fo:table-cell fo:block font-family=Arial font-size=12pt font-weight=bold break-after=auto space-after=10pt text-align=left xsl:call-template name=text_display_and_edit xsl:with-param name=text_number select=number('2') / xsl:with-param name=text_firstname select=string('TEXT') / xsl:with-param name=texttype select=string('norich') / /xsl:call-template /fo:block /fo:table-cell /fo:table-row /fo:table-body /fo:table /fo:flow /xsl:template Thanks, Luke - Original Message - From: Luke Shannon [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 10, 2005 2:43 PM Subject: Document Questions Hello; I am working on creating all the various layouts our product supports in FO. Having some issues. The code below runs when it is time to get the FO input: !-- fo root: all document properties go inside this tag -- fo:root xmlns:fo=http://www.w3.org/1999/XSL/Format; !-- configure the page attributes -- fo:layout-master-set fo:simple-page-master master-name=simple 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-top=3cm/ fo:region-before extent=3cm/ fo:region-after extent=1.5cm/ /fo:simple-page-master /fo:layout-master-set !-- ouput the content -- fo:page-sequence master-reference=simple xsl:call-template name=s2_pdf / /fo:page-sequence /fo:root Here is the template it calls: xsl:template name=s2_pdf fo:flow flow-name=xsl-region-start fo:block IMG SRC={$spacepath} WIDTH=9 HEIGHT=1 / /fo:block /fo:flow fo:flow flow-name=xsl-region-body !-- text 1 -- fo:block font-family=Arial font-size=12pt font-weight=bold break-after=auto space-after=10pt text-align=left xsl:call-template name=text_display_and_edit xsl:with-param name=text_number select=number('1') / xsl:with-param name=text_firstname select=string('TEXT') / xsl:with-param name=texttype select=string('norich') / /xsl:call-template /fo:block !-- text 2 -- fo:block font-family=Arial font-size=12pt font-weight=normal text-align=left xsl:call-template name=text_display_and_edit xsl:with-param name=text_number select=number('2') / xsl:with-param name=text_firstname select=string('TEXT') / xsl:with-param name=texttype select=string('norich') / /xsl:call-template /fo:block /fo:flow I have 2 problems. 1. With the image tag the way that it is, I get an error claiming the tag needs an accompaning /img. This is confusing to me because the tag above contains a /. 2. If I take the image tag out I get a message complaining about more than one flow in a page sequence. How else can I write to different xsl: regions of the same page? Should I just use tables for this? Thanks, Luke - 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: Document Questions
Thanks. It was the missing column declarations. I don't know all of the pieces of this system, I am guessing this was giving an error but somewhere in the code that exception was being caught and not reported. My issue now is getting the document to find the image source I want to use. fo:block fo:external-graphic src=url(hockey_canada0104.jpg)/ /fo:block What path should I be putting before the image name? One from the tomcat bin directory to the location of the image on the server? Right now the image gets dumped in the same place the PDF is saved to. Thanks for the help, Luke - Original Message - From: J.Pietschmann [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 10, 2005 5:12 PM Subject: Re: Document Questions Luke Shannon wrote: fo:region-body margin-top=3cm/ fo:region-before extent=3cm/ fo:region-after extent=1.5cm/ Minor problem here: your body region overlaps region-after. fo:table fo:table-body No fo:table-columns here. Bad. FOP 0.20.5 can't do table auto layout. Also, you should have got a warning about using a fixed table layout. Look carefully. xsl:with-param name=text_number select=number('1') / Utterly redundant XPath type conversion. xsl:with-param name=text_firstname select=string('TEXT') / xsl:with-param name=texttype select=string('norich') / More redundant XPath type conversions. 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]
Unbound Error
Hello; I am getting the error: org.xml.sax.SAXParseException: The prefix fo for element fo:block is not bound. I have been clicking around the form archives trying to find a solution to this without much luck. Can someone give me a hint? Thanks, Luke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Unbound Error
Hello Andreas; This is the nature of my problem. The block lies outside of the root. It is in a template. I start in root, write some generic stuff and than depending on the params jump of the one of several templates to write out the content. Each template needs to contains its own formatting schema. I was hoping to do this by embedding the content in a fo block. If this is allowed, do I have any other options? I would like to avoid complicating the root template with 13 different output options. Thanks, Luke - Original Message - From: Andreas L. Delmelle [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, January 07, 2005 1:36 PM Subject: RE: Unbound Error -Original Message- From: Luke Shannon [mailto:[EMAIL PROTECTED] Hi, I am getting the error: org.xml.sax.SAXParseException: The prefix fo for element fo:block is not bound. Without seeing your FO source, difficult to say for sure, but it points to an error in there. Could be caused by something as simple as: ?xml version=1.0 standalone=yes? fo:block / fo:root xmlns:fo=http://www.w3.org/1999/XSL/Format; ... /fo:root Having a block outside of the root is, of course, a major error, but even if it weren't the 'fo:' prefix is not yet bound to a namespace for the first fo:block. This error would be encountered before the FO is validated --'validation' being somewhat of an overstatement considering FOP 0.20.5, but you get the idea ;-) HTH! Greetz, Andreas - 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]
Complex Layouts
Hey All; I have got my PDF generation system working for a basic layout. The thing is our content generation supports 12 layouts. The simplest one is a title followed by some text. A more advanced one contains 3 images running vertical down the page (each with a title above it) and a column of text to the right of this (also with a title). My question is there seems to be a few tools for creating different layouts. What is easiest to work with for something like this (fo: table maybe)? Thanks, Luke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Need Some Help
Thank you Andreas! Works very well. - Original Message - From: Andreas L. Delmelle [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, January 05, 2005 6:21 PM Subject: RE: Need Some Help -Original Message- From: Luke Shannon [mailto:[EMAIL PROTECTED] Hi, My new issue is how to render the PDF with a string input containing the contents of the FO file. From java.lang.String to java.io.StringReader to java.io.Reader to org.xml.sax.InputSource? HTH! Greetz, Andreas - 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]
Need Some Help
Hi All; Trying to get a FOP demo off the ground. The idea is an FO document comes in from memory and is rendered to a PDF on the hard disk of the server. Just to get things going I am working with a FO file on the hard drive as well. I will tackle the contents of this file submitted in memory next. Below is my code. When I run it in IE it get a Pop up message telling me the File does not begin with '%PDF-'. This is weird to me because I am not trying to send it back through the response object, I don't know why the browser is even looking at it. When I run it in FireFox I get my success message printed, and the document created. However when I trying and open it I am told there is a Sharing Violation. The writer was closed before I printed the success statement so I am not sure where the conflict came from. Is there a better, smarter or easier way to do this? Any help would be appreciated. Thanks, Luke /* * Test class to get this FOP stuff working */ import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import org.apache.fop.apps.Driver; import org.xml.sax.*; /** * This class is intended to demonstrate submitting a FO document in memory * (String) to FOP and write a PDF document to the server. */ public class FopServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException { try { //the input File fofile = new File(D:\\applications\\fop\\fop-0.20.5\\test.fo); //location to write to File indexPDF = new File(D:\\applications\\fop\\fop-0.20.5\\index.pdf); //create an input stream from the input file InputStream in = new FileInputStream(fofile); //FOP Driver Driver driver = new Driver(); //set the render type driver.setRenderer(Driver.RENDER_PDF); //Setup output stream OutputStream out = new FileOutputStream(indexPDF); out = new BufferedOutputStream(out); //configure the input and the output driver.setInputSource(new InputSource(D:\\applications\\fop\\fop-0.20.5\\test.fo)); driver.setOutputStream(out); //run the driver driver.run(); //get the content String pdfFileContent = out.toString(); //create the file writer FileWriter writer = new FileWriter(indexPDF); //get content into buffer BufferedReader br = new BufferedReader(new StringReader(pdfFileContent)); //inialize a string to hold each line String str = ; //write the file while ((str = br.readLine()) != null) { writer.write(str); } //close up the writer writer.close(); //write the success message PrintWriter output = response.getWriter(); output.println(htmlheadtitleSuccess/title/head\n + bodyh1Nice Work!/h1/body/html); } catch (Exception ex) { throw new ServletException(ex); } } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Need Some Help
Responding to myself. I have found the problem, this code below works. I am still interested if anyone knows better way to do this. Thanks, Luke /* * Test class to get this FOP stuff working */ import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import org.apache.fop.apps.Driver; import org.xml.sax.*; /** * This class is intended to demonstrate submitting a FO document in memory * (String) to FOP and write a PDF document to the server. */ public class FopServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException { try { //the input File fofile = new File(D:\\applications\\fop\\fop-0.20.5\\test.fo); //location to write to File indexPDF = new File(D:\\applications\\fop\\fop-0.20.5\\index.pdf); //create an input stream from the input file InputStream in = new FileInputStream(fofile); //FOP Driver Driver driver = new Driver(); //set the render type driver.setRenderer(Driver.RENDER_PDF); //Setup output stream OutputStream out = new FileOutputStream(indexPDF); out = new BufferedOutputStream(out); //configure the input and the output driver.setInputSource(new InputSource(D:\\applications\\fop\\fop-0.20.5\\test.fo)); driver.setOutputStream(out); //run the driver driver.run(); out.close(); PrintWriter output = response.getWriter(); output.println(htmlheadtitleSuccess/title/head\n + bodyh1Nice Work!/h1/body/html); } catch (Exception ex) { throw new ServletException(ex); } } } - Original Message - From: Luke Shannon [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, January 05, 2005 4:58 PM Subject: Need Some Help Hi All; Trying to get a FOP demo off the ground. The idea is an FO document comes in from memory and is rendered to a PDF on the hard disk of the server. Just to get things going I am working with a FO file on the hard drive as well. I will tackle the contents of this file submitted in memory next. Below is my code. When I run it in IE it get a Pop up message telling me the File does not begin with '%PDF-'. This is weird to me because I am not trying to send it back through the response object, I don't know why the browser is even looking at it. When I run it in FireFox I get my success message printed, and the document created. However when I trying and open it I am told there is a Sharing Violation. The writer was closed before I printed the success statement so I am not sure where the conflict came from. Is there a better, smarter or easier way to do this? Any help would be appreciated. Thanks, Luke /* * Test class to get this FOP stuff working */ import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import org.apache.fop.apps.Driver; import org.xml.sax.*; /** * This class is intended to demonstrate submitting a FO document in memory * (String) to FOP and write a PDF document to the server. */ public class FopServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException { try { //the input File fofile = new File(D:\\applications\\fop\\fop-0.20.5\\test.fo); //location to write to File indexPDF = new File(D:\\applications\\fop\\fop-0.20.5\\index.pdf); //create an input stream from the input file InputStream in = new FileInputStream(fofile); //FOP Driver Driver driver = new Driver(); //set the render type driver.setRenderer(Driver.RENDER_PDF); //Setup output stream OutputStream out = new FileOutputStream(indexPDF); out = new BufferedOutputStream(out); //configure the input and the output driver.setInputSource(new InputSource(D:\\applications\\fop\\fop-0.20.5\\test.fo)); driver.setOutputStream(out); //run the driver driver.run(); //get the content String pdfFileContent = out.toString(); //create the file writer FileWriter writer = new FileWriter(indexPDF); //get content into buffer BufferedReader br = new BufferedReader(new StringReader(pdfFileContent)); //inialize a string to hold each line String str = ; //write the file while ((str = br.readLine()) != null) { writer.write(str); } //close up the writer writer.close(); //write the success message PrintWriter output = response.getWriter
Re: Need Some Help
Hi; Thanks for the response. I fixed the problem. Had the OutputStream still opened. I responded to my previous question myself with the new functioning code. I guess the forum (or my mail server) is slow. My new issue is how to render the PDF with a string input containing the contents of the FO file. Luke - Original Message - From: J.Pietschmann [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, January 05, 2005 6:01 PM Subject: Re: Need Some Help Luke Shannon wrote: When I run it in IE Ouch! :-) it get a Pop up message telling me the File does not begin with '%PDF-'. This is weird to me because I am not trying to send it back through the response object, I don't know why the browser is even looking at it. Does the URL which invokes the servlet end in .pdf? IEx is easily fooled, especially in absence of a content-type header. Try to use an URL which ends in .htm or .html, or explicitely set the content type to text/html, or both. 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]
New To Fop
Hello; I need a advice from more experienced FOP developers. The web project I am contracting on needs to be able to generate a PDF version of various pages the user may be browsing. As of now the only input I have to work with is the HTML of the page being displayed (the system can return it to me as a string during runtime). Speed is a factor so a requirements is the system only creates a new PDF document when the previously created one is out of synch with the content. I need to get this done fast. Can someone suggest what they think the best strategy will be for me to create the document? Should I use an .fo input? Transform the HTML into XML and process it with an XSL? Any tips from some who has done something similar would be very very helpful and appreciated. With Regards, Luke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: New To Fop
Thanks Will. This is the sort of advice I was hoping for. From the little I have played with FOP this makes sense. I would be interested in looking at any code you would like to share. Luke - Original Message - From: Will Gilbert [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 04, 2005 11:30 AM Subject: Re: New To Fop Luke, What you are looking to do comes up pretty often on this list so you will probably get quite a bit of help. Here's mine What you will need to do is go from HTML into XML then into FO, once in FO, FOP can render it quite quickly into a PDF, your browser can even be used as the delivery mechanism. I wrote a Java Servlet which is invoked via an HTML page link, the links passes the necessary parameters. In your case that will be a reference to the original HMTL file. The next step is not obvious, hence this e-mail. Not all HTML is XML-ready, humans make mistakes which most browsers correct, unbalanced and missing tags for example. Also some tags need to be doctored, BR and HR come to mind, these have no closing tags. What I did here was to use the Tidy engine/library to fix up my HTML into valid XML. Now the job gets pretty easy... The next step is to develop an XSL transform which takes HMTL tags and create FO XML. I have some transforms which I am very happy to share with you, as will others. Nobody has a complete HTML to FO implementation as this would be huge but you can get most of the transform working quickly and then add to it as needed. Once you have the FO XML -- BOOM, a few lines of code later and you've got your PDF. The servlet I wrote actually communicates back to the browser every second and fakes an elapsed progress timer. We had to do this as we originally were running on slow hardware and have very impatient. With our hardware these days the transform and PDF generation runs so quickly, the interaction is more of a nuisance that an aid. But at the time that is what the boss wanted, so I wrote it. --will - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: New To Fop
Hi Will; What I did here was to use the Tidy engine/library to fix up my HTML into valid XML. This library you are referring to. Which package is it part of? Thanks, Luke - Original Message - From: Will Gilbert [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, January 04, 2005 11:30 AM Subject: Re: New To Fop Luke, What you are looking to do comes up pretty often on this list so you will probably get quite a bit of help. Here's mine What you will need to do is go from HTML into XML then into FO, once in FO, FOP can render it quite quickly into a PDF, your browser can even be used as the delivery mechanism. I wrote a Java Servlet which is invoked via an HTML page link, the links passes the necessary parameters. In your case that will be a reference to the original HMTL file. The next step is not obvious, hence this e-mail. Not all HTML is XML-ready, humans make mistakes which most browsers correct, unbalanced and missing tags for example. Also some tags need to be doctored, BR and HR come to mind, these have no closing tags. What I did here was to use the Tidy engine/library to fix up my HTML into valid XML. Now the job gets pretty easy... The next step is to develop an XSL transform which takes HMTL tags and create FO XML. I have some transforms which I am very happy to share with you, as will others. Nobody has a complete HTML to FO implementation as this would be huge but you can get most of the transform working quickly and then add to it as needed. Once you have the FO XML -- BOOM, a few lines of code later and you've got your PDF. The servlet I wrote actually communicates back to the browser every second and fakes an elapsed progress timer. We had to do this as we originally were running on slow hardware and have very impatient. With our hardware these days the transform and PDF generation runs so quickly, the interaction is more of a nuisance that an aid. But at the time that is what the boss wanted, so I wrote it. --will - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]