Mobile app version of vmapp.org
Login or Join
Sue6373160

: Is SVG conversion to PDF lossless and deterministic? 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

@Sue6373160

Posted in: #ImageFormat #Pdf #Svg

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?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Sue6373160

1 Comments

Sorted by latest first Latest Oldest Best

 

@Yeniel278

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme