Assuming an SVG is converted to PDF vector paths.

  • Deterministic: Will program A (e.g. Inkscape) produce the same PDF for a given SVG as program B (e.g. Ghostscript)?

  • Lossless: In the same program, will every PDF visually resemble the original SVG, regardless of SVG complexity?

  • 1
    Vector data, by nature, is always lossless. If your svg is entirely vector based, there would be no difference. – Scott Aug 24 '17 at 4:53
  • @Scott Scaling yes, but the conversion between different vector formats need not be. E.g. There might be restrictions on what kind of vectors are supported in one format. – jiggunjer Aug 24 '17 at 4:56
  • Not really... a path from point x1,y1 to point x10,y10.. is still going to be that same path. – Scott Aug 24 '17 at 4:57
  • @Scott Not if the format doesn't allow polygons with more than N points. Or forces certain function fits onto those points. I don't know the limits of these two formats. If they are both pure unrestricted mathematical vector formats, then yes. Otherwise maybe. – jiggunjer Aug 24 '17 at 5:00
  • @ZachSaucier It very much affects the appearance of a design! And it is a common scenario in many design workflows. Plus, a close vote is hypocritical since there are many similar questions on here relating to format differences and idiosyncrasies. – jiggunjer Aug 24 '17 at 5:41

Not necessarily. For the conversion to succeed without problems you must first ensure that:

  • You only use features that are present in both SVG and PDF specifications.
  • Your converter is interpreting the numeric values as a string and pastes them as such into the PDF stream.

In practice if you only need similar look and feel then the second point is somewhat immaterial, but still not lossless. I am not aware of any generally available converter actually ensuring the second point.

Now SVG has lent quite many features directly from PDF (and thus by legacy form EPS). For example the d attribute of a SVG <path> tag is directly lent out of PDF spec, which is one reason why its so unlike XML*. For those elements there is no problems. However SVG has features that do not really make sense in the PDF such as the filters, which will degrade.

Also there are many features that affect use of elements later that get expanded on export. For example in SVG you could define a arrowhead once and reuse it in many places whereas PDF has no such facility, thus modeling information is lost. Although this does not affect the output it may affect the intention when needing to re-edit.

Secondly the converter itself must support all the used features. If not then the data gets lost. This is not necessarily related to features of SVG or PDF directly. Its very rare to see software that have full support for all elements possible. Even Adobe does not do this to 100%.

But as long as you use the simple subset of PDF and SVG then you can be sure that it works.

* which is also the reason why it has been relatively painless to make a decent though not perfect PDF viewer inside browsers.

| improve this answer | |
  • 1
    is there any way to sanitize or check an SVG for PDF support, some metric e.g. "this SVG is 95% PDF compliant" before I attempt to convert? – jiggunjer Aug 24 '17 at 7:30
  • @jiggunjer i am not aware of such tools. – joojaa Aug 24 '17 at 8:50
  • Check out github.com/cncf/svg-autocrop which ensures that there are no lossy embedded images (such as PNG or JPEG) and no use of fonts that may not render correctly. – Dan Kohn Mar 26 '19 at 14:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.