Return-Path: Delivered-To: apmail-xmlgraphics-batik-users-archive@www.apache.org Received: (qmail 37168 invoked from network); 22 Aug 2007 11:28:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 22 Aug 2007 11:28:43 -0000 Received: (qmail 40953 invoked by uid 500); 22 Aug 2007 11:28:40 -0000 Delivered-To: apmail-xmlgraphics-batik-users-archive@xmlgraphics.apache.org Received: (qmail 40928 invoked by uid 500); 22 Aug 2007 11:28:40 -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 40917 invoked by uid 99); 22 Aug 2007 11:28:40 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Aug 2007 04:28:40 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [134.245.248.209] (HELO miraculix.informatik.uni-kiel.de) (134.245.248.209) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Aug 2007 11:29:13 +0000 Received: from localhost (IDENT:t1qJtcaKY7eSZL0vDg64azCJ+oeAces1@localhost [127.0.0.1]) by miraculix.informatik.uni-kiel.de (8.13.8/8.13.8) with ESMTP id l7MBSFnG010063 for ; Wed, 22 Aug 2007 13:28:15 +0200 (MEST) Received: from falbala.informatik.uni-kiel.de (falbala [134.245.248.202]) by miraculix.informatik.uni-kiel.de (8.13.8/8.13.8) with ESMTP id l7MBS5tp010046 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 22 Aug 2007 13:28:11 +0200 (MEST) Received: from [10.6.0.24] (sunbeam [134.245.253.156]) by falbala.informatik.uni-kiel.de (8.13.8/8.13.8) with ESMTP id l7MBS3xh000312 for ; Wed, 22 Aug 2007 13:28:03 +0200 (MEST) Message-ID: <46CC1DC3.1070300@informatik.uni-kiel.de> Date: Wed, 22 Aug 2007 13:28:03 +0200 From: Steffen Jacobs Organization: AG Echtzeitsysteme / Eingebettete Systeme User-Agent: Icedove 1.5.0.12 (X11/20070607) MIME-Version: 1.0 To: batik-users@xmlgraphics.apache.org Subject: Re: SVG2PDF programatically References: <46CB2876.8030804@googlemail.com> <46CBED03.5010806@informatik.uni-kiel.de> <46CC08BB.3000308@googlemail.com> In-Reply-To: <46CC08BB.3000308@googlemail.com> X-Enigmail-Version: 0.94.2.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at informatik.uni-kiel.de X-Virus-Checked: Checked by ClamAV on apache.org Now that i read your question again more carefully, I am not sure what you mean by 'convert a svg string'. Do you have a valid SVG file, or just some XML/SVG snippets to convert? In the former case, you can use batik to get the SVGDocument tree of your file, create a new PDFTranscoder object and use the transcode(input, output) method as written in my example. In the latter case, you have to create a SVGDocument first, add your SVG 'snippets' to the document tree and use transcode again. To do so just copy'n'paste my code example and insert your svg snippets into the document tree after the line marked with // ... draw some shapes ... and replace the next line with something like File pdf = new File('mypdf.pdf'); Mork0075 wrote: > Thank you Steffen, but where comes the svg snippet in place, which > already exists? > > Steffen Jacobs schrieb: > >> Hi, >> >> you can try the pdf-transcoder library. An example from another forum >> may help: >> >> DOMImplementation impl = SVGDOMImplementation.getDOMImplementation(); >> String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI; >> Document document = impl.createDocument(svgNS, "svg", null); >> SVGGraphics2D g2d = new SVGGraphics2D(document); >> >> // ... draw some shapes ... >> File pdf = ... >> >> OutputStream out = new FileOutputStream(pdf); >> PDFTranscoder t = new PDFTranscoder(); >> TranscoderInput input = new TranscoderInput(document); >> TranscoderOutput output = new TranscoderOutput(out); >> try { >> t.transcode(input, output); >> } catch (Exception ex) { >> throw new IOException(ex.getMessage()); >> } finally { >> out.flush(); >> out.close(); >> } >> >> >> Regards, >> Steffen >> >> >> Mork0075 wrote: >> >> >>> Hello, >>> >>> can anyone give me a piece of code how to convert a svg string into a >>> pdf file? >>> >>> Thanks a lot :) >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org >>> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org >>> >>> >>> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org >> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org >> >> >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org > For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org