Insert SVG image into a PDF document

Hi all

I am creating a PDF with a barcode on it.

I am generate the barcode with the MBS plugin and saving it to a SVG file. I can load it back in and use a canvas to display it in good quality on screen. Likewise if I drop the SVG into something like Sketch it renders perfectly.
When I do the same in the PDF I get a decidedly poor render of the original sharp SVG

Is there a best practice to insert a SVG into the PDF file that retains the quality?

Am I missing something?

Thanks

You can use the Barcode plugin from us to output the vector drawing commands.
Then use these to draw it yourself to the PDF page.

Or use DynaPDF functions to draw a vector barcode.

1 Like

PDF doesn’t support SVG files. What you probably have in the PDF is a raster (bitmap) version of the barcode.

To have the best quality barcode you need to draw it using the vector commands available in DynaPDF. DynaPDF has some barcode functions which do that so you might be able to use them instead of doing it yourself.

1 Like

Thanks for the confirmation re: SVG in PDF. I started rendering the barcode myself using the vector commands. It’s working although I am having a little difficult with the width of the barcode and the scaling. I am sure I’ll get there. :+1:t2:

This is misleading…

What you mean (I suppose) is the Xojo built-in Postscript do not support Vector Graphics…

Why ?
Because I was able (long time ago) to put Object2D Vectors into a pdf file and that PDF hold the Vector Graphics. I used Print to PDF the Object2D Picture, there was no Postscript build-in Xojo at those times.

Emile, I really don’t know what you are trying to say.

PostScript is not the same as PDF and Object2D is not SVG.

This is also not a limitation of Xojo.

The Adobe PDF specification does not support SVG so you can’t just take some SVG data, embed it into a PDF and then display it.

It would, however, be possible to convert a lot of the SVG commands into PDF commands but that requires some work.