Return-Path: Delivered-To: apmail-xmlgraphics-batik-users-archive@www.apache.org Received: (qmail 42520 invoked from network); 18 Oct 2010 16:04:22 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 18 Oct 2010 16:04:22 -0000 Received: (qmail 38910 invoked by uid 500); 18 Oct 2010 16:04:22 -0000 Delivered-To: apmail-xmlgraphics-batik-users-archive@xmlgraphics.apache.org Received: (qmail 38829 invoked by uid 500); 18 Oct 2010 16:04:21 -0000 Mailing-List: contact batik-users-help@xmlgraphics.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: batik-users@xmlgraphics.apache.org Delivered-To: mailing list batik-users@xmlgraphics.apache.org Received: (qmail 38822 invoked by uid 99); 18 Oct 2010 16:04:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Oct 2010 16:04:21 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of kelseyrider@hotmail.com designates 65.55.111.104 as permitted sender) Received: from [65.55.111.104] (HELO blu0-omc2-s29.blu0.hotmail.com) (65.55.111.104) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Oct 2010 16:04:13 +0000 Received: from BLU132-W14 ([65.55.111.72]) by blu0-omc2-s29.blu0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 18 Oct 2010 09:03:52 -0700 Message-ID: Content-Type: multipart/alternative; boundary="_1fadc6e9-9de6-4b13-8788-bddd49e9aad5_" X-Originating-IP: [193.252.24.134] From: Kelsey Rider To: Subject: SVGGraphics2D::drawString Date: Mon, 18 Oct 2010 12:03:52 -0400 Importance: Normal MIME-Version: 1.0 X-OriginalArrivalTime: 18 Oct 2010 16:03:52.0591 (UTC) FILETIME=[0F2291F0:01CB6EDE] --_1fadc6e9-9de6-4b13-8788-bddd49e9aad5_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello=2C I'm a developer working on a project to convert PDF files to SVG=2C using p= dfbox and batik. Pdfbox already contains methods to draw the PDF onto a Gr= aphics2D object=2C with the goal to export to JPG=2C GIF=2C etc. However= =2C when I supply a SVGGraphics2D object=2C I observe two problems with the= text (probably due to the same issue): - the text is distorted - badly positioned=2C wrong size=2C etc. - certain characters don't appear. For example=2C the euro symbol. This p= articular character actually causes SVGGraphics2D::drawString to put an inv= alid character (0x02) in the XML. The string passed to drawString contains= a single byte=2C 0x02=3B however=2C in the PDF this character is mapped to= a type1 font and (I think) describes how to draw it. Example code: doc =3D PDDocument.load(url)=3BDOMImplementation domImpl =3D GenericDOMImpl= ementation.getDOMImplementation()=3BDocument document =3D domImpl.createDoc= ument("http://www.w3.org/2000/svg"=2C "svg"=2C null)=3BSVGGraphics2D graphi= cs =3D new SVGGraphics2D(document)=3B....PageDrawer.drawPage(graphics=2C pa= ge=2C pageDimension)=3BFile outFile =3D new File("out.svg")=3BWriter out = =3D new OutputStreamWriter(new FileOutputStream(outFile)=2C "UTF-8")=3Bgrap= hics.stream(out)=3Bout.close()=3B I realize that the problem seems like it may be with pdfbox=3B however=2C t= he output is fine when exporting to=2C say=2C JPG (in which case the graphi= cs object is a SunGraphics2D). I looked at the source code but I'm afraid = it's a bit over my head=3B the biggest thing I can see is that the algorith= ms are completely different. :) The output is correct when I manually set = generatorCtx.svgFont=3Dtrue=2C but of course this makes the output file big= ger (10MB instead of 8MB). Any help on this issue would be greatly appreciated. If needed=2C I can se= nd a PDF to duplicate the problem. Thank you for your time=2C Kelsey Rider = --_1fadc6e9-9de6-4b13-8788-bddd49e9aad5_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello=2C

I'm a developer working on a project to conve= rt PDF files to SVG=2C using pdfbox and batik.  =3BPdfbox already conta= ins methods to draw the PDF onto a Graphics2D object=2C with the goal to ex= port to JPG=2C GIF=2C etc.  =3BHowever=2C when I supply a SVGGraphics2D= object=2C I observe two problems with the text (probably due to the same i= ssue):
- the text is distorted - badly positioned=2C wrong size=2C etc.<= br>- certain characters don't appear.  =3BFor example=2C the euro symbo= l.  =3BThis particular character actually causes SVGGraphics2D::drawStr= ing to put an invalid character (0x02) in the XML.  =3BThe string passe= d to drawString contains a single byte=2C 0x02=3B however=2C in the PDF thi= s character is mapped to a type1 font and (I think) describes how to draw i= t.

Example code:

doc =3D PDDocument.load(url)=3B
DOMImplementation domI= mpl =3D GenericDOMImplementation.getDOMImplementation()=3B
Document document =3D domImpl.createDo= cument("http://www.w3.org/2000/svg"=2C "svg"=2C null)=3B
SVGGraphics2D graphics =3D new SVGGraphic= s2D(document)=3B
....
PageDrawer.drawPage(graphics=2C page=2C pageDimension)=3B=
File outFile =3D new File("out.svg")=3B
Writer out =3D new OutputStreamWriter(new FileOutputStre= am(outFile)=2C "UTF-8")=3B
graphics.stream(out)=3B
out.close()=3B

=

I realize that the probl= em seems like it may be with pdfbox=3B however=2C the output is fine when e= xporting to=2C say=2C JPG (in which case the graphics object is a SunGraphi= cs2D).  =3BI looked at the source code but I'm afraid it's a bit over m= y head=3B the biggest thing I can see is that the algorithms are completely= different. :)  =3BThe output is correct when I manually set generatorC= tx.svgFont=3Dtrue=2C but of course this makes the output file bigger (10MB = instead of 8MB).

Any help on this issue would be greatly appreciated.  =3BIf ne= eded=2C I can send a PDF to duplicate the problem.

Thank you for your time=2C

Kelsey Rider=
= --_1fadc6e9-9de6-4b13-8788-bddd49e9aad5_--