xmlgraphics-batik-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremias Maerki <...@jeremias-maerki.ch>
Subject Re: Graphics2D to PDF
Date Wed, 06 Aug 2008 20:25:46 GMT
On 06.08.2008 22:11:10 Bill Gamble wrote:
> Hello Everyone,
> 
>  
> 
> I am new to Apache XML Graphics projects and I was wondering if someone
> could answer a few questions for me or point me in the right direction where
> I can find them myself.
> 
>  
> 
> What I am trying to accomplish: I am trying to use a Graphics2D object to
> draw to a multi page PDF document. 
> 
>  
> 
> I have read through the descriptions of Batik, FOP, and the Graphics Commons
> project, and look through the available documentation and code samples and
> here is what I gathered so far:
> 
>  
> 
> 1)    I will need to draw out to an SVG file (in my case, multiple SVG
> files) with Batik.
>
> 2)    Use FOP to read in the SVG files and write them to PDF.

If I understand you correctly, you need to convert multiple SVGs to one
PDF, right? In that case, I'd recommend using FOP with the
fox:external-document extension (one such element per SVG):
http://xmlgraphics.apache.org/fop/0.95/extensions.html#external-document
Obviously, that requires a minimal FO file that sticks the SVGs together.
That can easily be generated from a minimal XML file with the filenames
and a stylesheet that generates the necessary FO tags.

If it's about converting only one SVG to PDF you can use the above or
you can use the PDFTranscoder (which unfortunately is still in FOP
although it's long been decided it should move. Just hasn't happened,
yet). http://xmlgraphics.apache.org/batik/using/transcoder.html
>  
> 
> Is this correct? I was intrigued by the Graphics Commons overview which
> stated it provides "Graphics2D implementations that let you generate PDF &
> PostScript files, and much more." and got me all excited, however I was not
> able to find any documentation, examples, etc on how to do this. I googled
> it for a while but was not able to come up with anything relevant.

Hmm, some of that description still only is about our dreams. Reality is
a bit behind still. ;-) There's a Graphics2D implementation there, but
the PDFDocumentGraphics2D class is still in FOP. It's still on my list
to move it....I'm hoping for more free time and energy. ;-)

But I don't recommend interfacing directly with PDFDocumentGraphics2D if
you need to process SVG. It's probably much easier to use a higher-level
API like the Batik Transcoder API or the FOP API.

>  
> 
> If anyone can:
> 
>  
> 
> 1)    Confirm or correct the statements about the best approach to producing
> a multipage PDF document.

See above.

> 2)    Point me to any documentation, javadocs, etc. I am probably missing
> something but have not been able to find much documentation at all.

Javadocs can be produced for all of Batik, FOP and Commons. I hope that
above tips help you. Otherwise, please ping me again.

Please post questions to the user list next time. Thanks!



Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


Mime
View raw message