SVG Graphics in FOP
Hi Guys, Any idea why when I'm using SVG to draw, it seems to have a whacky concept of units if I use anything _other_ than no units at all? I used a height of 55mm for instance and it seemed to take up several pages, and my x/y co-ordinates were not consistent between lines and rectangles either Thanks Martin
Re: SVG Graphics in FOP
Hi, a good practice is to use the (viewBox, height, width) attribute set on svg element; you can leave all your size values without unit (defaulting to px or pt, I don't remember). ... And explicitly add your preferred unit on both svg/@width and svg/@height. Another option is to use FO content-* properties on fo:instream-foreign-object or fo:external-graphic, and leave svg/@width and svg/@height without unit. fo:block font-size=0pt fo:instream-foreign-object content-height=24pt content-width=48pt svg xmlns=http://www.w3.org/2000/svg; viewBox=0 0 48 24 height=24pt width=48pt g style=fill: none; stroke:black; stroke-width:0.25; line y2=12 x2=48 y1=12 x1=0/ line y2=24 x2=24 y1=0 x1=24/ circle r=6 cy=12 cx=24/ /g /svg /fo:instream-foreign-object /fo:block 2013/9/5 Martin Edge martin.e...@intellimail.com.au: Hi Guys, Any idea why when I’m using SVG to draw, it seems to have a whacky concept of units if I use anything _other_ than no units at all? I used a height of 55mm for instance and it seemed to take up several pages, and my x/y co-ordinates were not consistent between lines and rectangles either Thanks Martin -- pascal - To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org
Re: SVG Graphics in FOP
Hey Pascal - Ill give that a go, (the instream sizing might help), trying to steer clear of pixels because I believe that it varies based on FOPs DPI setting and therefore would have mixed results on differing installations Thanks! Martin On 05/09/2013, at 7:04 PM, Pascal Sancho psancho@gmail.com wrote: Hi, a good practice is to use the (viewBox, height, width) attribute set on svg element; you can leave all your size values without unit (defaulting to px or pt, I don't remember). ... And explicitly add your preferred unit on both svg/@width and svg/@height. Another option is to use FO content-* properties on fo:instream-foreign-object or fo:external-graphic, and leave svg/@width and svg/@height without unit. fo:block font-size=0pt fo:instream-foreign-object content-height=24pt content-width=48pt svg xmlns=http://www.w3.org/2000/svg; viewBox=0 0 48 24 height=24pt width=48pt g style=fill: none; stroke:black; stroke-width:0.25; line y2=12 x2=48 y1=12 x1=0/ line y2=24 x2=24 y1=0 x1=24/ circle r=6 cy=12 cx=24/ /g /svg /fo:instream-foreign-object /fo:block 2013/9/5 Martin Edge martin.e...@intellimail.com.au: Hi Guys, Any idea why when I’m using SVG to draw, it seems to have a whacky concept of units if I use anything _other_ than no units at all? I used a height of 55mm for instance and it seemed to take up several pages, and my x/y co-ordinates were not consistent between lines and rectangles either Thanks Martin -- pascal - To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org - To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org
Re: SVG Graphics in FOP
Yes, px is media dependant, so its usage is not recommended. 2013/9/5 Martin Edge martin.e...@intellimail.com.au: Hey Pascal - Ill give that a go, (the instream sizing might help), trying to steer clear of pixels because I believe that it varies based on FOPs DPI setting and therefore would have mixed results on differing installations Thanks! Martin On 05/09/2013, at 7:04 PM, Pascal Sancho psancho@gmail.com wrote: Hi, a good practice is to use the (viewBox, height, width) attribute set on svg element; you can leave all your size values without unit (defaulting to px or pt, I don't remember). ... And explicitly add your preferred unit on both svg/@width and svg/@height. Another option is to use FO content-* properties on fo:instream-foreign-object or fo:external-graphic, and leave svg/@width and svg/@height without unit. fo:block font-size=0pt fo:instream-foreign-object content-height=24pt content-width=48pt svg xmlns=http://www.w3.org/2000/svg; viewBox=0 0 48 24 height=24pt width=48pt g style=fill: none; stroke:black; stroke-width:0.25; line y2=12 x2=48 y1=12 x1=0/ line y2=24 x2=24 y1=0 x1=24/ circle r=6 cy=12 cx=24/ /g /svg /fo:instream-foreign-object /fo:block 2013/9/5 Martin Edge martin.e...@intellimail.com.au: Hi Guys, Any idea why when I’m using SVG to draw, it seems to have a whacky concept of units if I use anything _other_ than no units at all? I used a height of 55mm for instance and it seemed to take up several pages, and my x/y co-ordinates were not consistent between lines and rectangles either Thanks Martin -- pascal - To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org - To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org -- pascal - To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org
RE: html content in xml input file.
Hi, You should put formatting in the xml file. So xml should look like Return_Address namexyz/name street101 avc/street /Return_Address Then apply fo formatting in xsl fo:block fo:inline font-size=16px fo:inline font-weight=bold fo:inline font-family= times new romanxsl:value-of select=name/ /fo:inline /fo:inline /fo:inline /fo:block Thanks From: Spoorthi Myneni [mailto:spoorthi.myne...@gmail.com] Sent: 03 September 2013 21:43 To: fop-users@xmlgraphics.apache.org Subject: html content in xml input file. Hi All, I am trying to generate PDF output using xml and xsl files as my input files. My input xml and xsl files are: 24_24177_Proof.xsl 24_24177_Recipient.xml (I have attached them). My xml file has a node where in I have CDATA like below: Return_Address ![CDATA[ fo:block fo:block fo:inline font-size=16px fo:inline font-weight=bold fo:inline font-family= times new romanThis is a smaple text with bold./fo:inline /fo:inline /fo:inline /fo:block fo:block /fo:block fo:block fo:inline font-size=16px fo:inline font-family= times new roman fo:inline font-style=italicThis is a sample text with Italic./fo:inline /fo:inline /fo:inline /fo:block fo:block /fo:block fo:block fo:inline font-size=16px fo:inline font-family= times new roman fo:inline text-decoration=underlineThis is a sample text with underline./fo:inline /fo:inline /fo:inline /fo:block /fo:block ]] /Return_Address I have run the below command and generated an fo file using the 24_24177_Proof.xsl and 24_24177_Recipient.xml file. fop -xml C:\Users\spoorthi\Desktop\24_24177_Reciepients. xml -xsl C:\Users\spoorthi\Desktop\24_24177_Proof.XSL -foout C:\Users\spoort hi\Desktop\24_24177_Proof.fo and then Generated pdf file using the above created fo file using the following command. fop -fo C:\Users\spoorthi\Desktop\24_24177_Proof.fo -pd f C:\Users\spoorthi\Desktop\24_24177_FoOutput.pdf -c fop.xconf My 24_24177_FoOutput.pdf gets the formatting of the content in the xml correctly. But when I directly use the -xml and -xsl files as input and generate the pdf file as ouput then the formatting of the text is not retained. I have used the following command and the output file is 24_24177_Proof.pdf fop -xml C:\Users\spoorthi\Desktop\24_24177_Reciepients. xml -xsl C:\Users\spoorthi\Desktop\24_24177_Proof.XSL -pdf C:\Users\spoorthi \Desktop\24_24177_Proof.pdf -c fop.xconf Can someone explain me on why it doesnot retain the formatting in the second case(using xml and xsl as input and generating pdf as output)? and I would like to know what else I need to include in order to get the formatting in the second case. I have attached all the files in the mail, for your reference. I have many instances like this for which I need this to work, any advice will be appreciated a lot. Thank you in advance. -Spoorthi