Bug 109025 - Vector graphics not 100% identical/precise in prints and generated PDFs
Summary: Vector graphics not 100% identical/precise in prints and generated PDFs
Status: RESOLVED DUPLICATE of bug 96892
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
(earliest affected) release
Hardware: x86-64 (AMD64) Windows (All)
: medium minor
Assignee: Not Assigned
Depends on:
Reported: 2017-07-08 17:27 UTC by christian-philipp
Modified: 2018-02-04 22:27 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:
Regression By:

All the files necessary to reproduce the problem & detailed screenshots (816.99 KB, application/x-zip-compressed)
2017-07-08 17:27 UTC, christian-philipp
Testcase 2 based on "clean" SVG (284.86 KB, application/x-zip-compressed)
2017-07-09 12:20 UTC, christian-philipp

Note You need to log in before you can comment on or make changes to this bug.
Description christian-philipp 2017-07-08 17:27:08 UTC
Created attachment 134554 [details]
All the files necessary to reproduce the problem & detailed screenshots

I stumbled upon some odd behaviour when printing and/or generating PDFs from documents containing vector graphics.

When inserting a vector graphic (tested with SVG, PDF 1.4, PDF 1.5 and EMF) into a document (tested in Writer and Draw) and generating a PDF from this document (either with LO's internal function or with FreePDF as a printer), the vector graphics are still vector graphics in the PDF, however they appear kind of "jagged" and unprecise, as if the Bézier node positions and values were approximated or very "generously rounded" (looking at the resulting PDF file with Adobe Reader DC 17.2304 and Inkscape 0.92.1).

I investigated a bit further and had a look at the nodes in Inkscape, comparing the original SVG to the generated PDF: Some of the smooth nodes (with symmetrical handles, depicted as a square in Inkscape) are converted to cusp nodes (with asymmetrical handles, depicted as a rhombus in Inkscape) and vice versa, resulting in deviations that (depending on the path and scale) go from slight / barely visible to clearly visible and ugly. Furthermore the nodes do not seem to be at the exact same coordinates.

As I apparently can only attach one file here, I put all the files in a ZIP archive:

original SVG file

original SVG file saved as PDF 1.4 with Inkscape 0.92.1 (using sample.svg as the source)

original SVG file saved as PDF 1.5 with Inkscape 0.92.1 (using sample.svg as the source)

original SVG file saved as EMF with Inkscape 0.92.1 (using sample.svg as the source)

Draw document with the vector graphics inserted

Draw document exported as PDF (PDF options: Losless compression, everything else unchecked)

Screenshot of a general comparison of the original SVG and the generated PDF file (Inkscape 0.92.1)

Screenshot of a comparison of the nodes in the original SVG and the generated PDF file (Inkscape 0.92.1)

Screenshot of a detailled comparison of some nodes in the original SVG and the generated PDF file (Inkscape 0.92.1)

Steps to reproduce the problem:

- open Draw

- insert one or more vector graphics, either by drag & drop or by using "Insert" => "Image"

- export the document to PDF

- open the resulting PDF in Adobe Reader or Inkscape and zoom in

Important note: The EMF file that I created from the SVG file in Inkscape shows very similar symptoms even before inserting it into Draw - the nodes are not exactly how they should be according to the original SVG file. Inserting this EMF file into Draw and generating a PDF will make things worse, so the resulting nodes in the PDF are even "more wrong" than before.

I have a hunch that there is a decimal precision loss happening at some point. And could it be that LO and Inkscape are using the same libraries for doing certain vector conversions?
Comment 1 Regina Henschel 2017-07-08 21:17:00 UTC
Please use for your tests strict SVG, without any elements or attributes in inkscape or sodipodi namespace. The path element has actually no smooth bézier curve segment, but the "smooth"-information is only written in the sodipodi:nodetypes attribute. You cannot expect, that other applications than Inkscape understand those namespaces.
Comment 2 christian-philipp 2017-07-09 12:20:38 UTC
Created attachment 134558 [details]
Testcase 2 based on "clean" SVG
Comment 3 christian-philipp 2017-07-09 12:21:46 UTC
Thanks for the quick response!

I added another testcase, now with a completely "clean" SVG (containing only paths and the bare minimum of necessary elements and attributes, no Inkscape or Sodipodi namespace) as a source in a Writer document, again with SVG, PDF and EMF - the result is still the same.

This time I added each vector file multiple times in multiple scales - the effect gets significantly worse with a smaller scale.
Comment 4 V Stuart Foote 2018-02-04 22:27:22 UTC

*** This bug has been marked as a duplicate of bug 96892 ***