Should I embed an image as a PDF or SVG?

The next version of Typst will probably allow you to embed PDFs directly as images. If I have both file formats available, I wonder whether I should embed an image as a PDF or an SVG. Are there any advantages to embedding the image as a PDF rather than an SVG, or vice versa?

It will allow to embed PDFs inside PDF as-is, without any alteration to the embedded PDFs. Both can have selectable text, vector graphics. It all comes down to file size, that’s what I would look at. But basically, use whichever you want.

Actually, I’m not sure how Document Outline will be handled, and other PDF-only things, but for PDF images this doesn’t matter.

1 Like

I haven’t tried the beta for PDF import, so this is more a hunch than an answer: as Andrew said, PDFs come as-is (i.e., they [should] render the same way everywhere). SVGs can be influenced by the environment (e.g. if the SVG uses a font that is not installed in the rendering system).

For a more consistent experience, I’d use PDFs as default for documents with text and advanced style like diagrams, and SVG for “simpler” graphics like logos or icons. But again, I haven’t tried the feature, so this is just my expectation.

1 Like

An important caveat of PDF embedding is that it won’t allow you to export to special output modes (like PDF/A3 or PDF/UA), so if you need that, you should definitely stick to SVG.

Otherwise, Using PDF directly might result in lower file sizes.

1 Like