pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Hewson <j...@jahewson.com>
Subject Re: Add SVG image to PDF
Date Fri, 25 Mar 2016 16:12:05 GMT

> On 24 Mar 2016, at 11:34, Ivan Ridao Freitas <info@ivanrf.com> wrote:
> 
> Hi, I would like to know if it possible to insert SVG images into a PDF with PDFBox 2.0.0.
> 
> In this old thread <http://pdfbox-users.markmail.org/search/?q=Toni+Helenius#query:Toni%20Helenius%20order%3Adate-backward+page:1+mid:6pncjl43qdhgiz35+state:results>
it is mentioned to use Apache Batik to convert SVG to PDF and then import on PDFBox.
> Is this still the best procedure?

Yes, this remains the best approach. You can import the PDF created by Batik as a PDFFormXObject,
which can be scaled and placed on the page as you wish.

If your SVG is trivial and always in some standard format (i.e. if it’s generated by some
other software tool) then you could consider parsing the SVG file yourself and then just drawing
the corresponding paths. I’ve done this for trivial black and white outlines before. But
for anything non-trivial I’d certainly choose the Batik approach.

— John

> I'm currently filling a PDF form with PDFBox which has an SVG on it. Now, I want to do
everything from the software. The SVG image is the only thing I don't know how to add and
I would like to avoid using PNG files instead of a vector.
> 
> Thanks,
> Ivan
> 
> PS: This was also asked by other user at Stackoverflow here <http://stackoverflow.com/questions/31718075/drawing-vector-images-on-pdf-with-pdfbox>.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Mime
View raw message