Random units in SVG when converting PDF to SVG
Summary:
Hi, I've upgraded to Inkscape v1.0 on Windows 10.
Using the command-line, as follows:
inkscape.exe --export-area-page --pdf-page=1 --export-text-to-path --export-background=ffffff --export-background-opacity=0.0 --export-plain-svg --export-overwrite --export-type=svg --export-filename=sample-file.svg sample-file.pdf
What I found out is that, if I run this command several times, within 6-10 attempts, the output SVG will be in different units.
Sometimes it will be in points (pt), for example, a few lines from the <svg> node:
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
sodipodi:docname="sample-file.pdf"
id="svg14"
version="1.2"
viewBox="0 0 115.5 153"
height="153pt"
width="115.5pt">
While, other times, the units will be in pixels (unspecified units), example from the same file (same input, same exact command):
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
sodipodi:docname="sample-file.pdf"
viewBox="0 0 154 204"
height="204"
width="154"
xml:space="preserve"
id="svg2"
version="1.1">
Why is the resulting SVG file inconsistent with the units?
I would prefer if it behaved as version 0.92.4, when the result would be always in pixels / unspecified units.
Steps to reproduce:
- Installed Inkscape v1.0 on Windows 10.
- open a command-line (terminal)
- run the following command several times (anywhere between 5-10 times, as necessary):
inkscape.exe --export-area-page --pdf-page=1 --export-text-to-path --export-background=ffffff --export-background-opacity=0.0 --export-plain-svg --export-overwrite --export-type=svg --export-filename=sample-file.svg sample-file.pdf
- notice how the resulting SVG file, sometimes is generated with different units: sometimes in pixels (unspecified units) and sometimes with points units (pt), here is the <svg> element from those two cases:
a) result in points (pt)
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
sodipodi:docname="sample-file.pdf"
id="svg14"
version="1.2"
viewBox="0 0 115.5 153"
height="153pt"
width="115.5pt">
b) result in pixels (unspecified units)
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
sodipodi:docname="sample-file.pdf"
viewBox="0 0 154 204"
height="204"
width="154"
xml:space="preserve"
id="svg2"
version="1.1">
What happened?
Inkscape randomly chooses to create the SVG file with different units.
Version 0.92.4 was consistently producing SVG files (from same input file) with pixels.
What should have happened?
Inkscape should produce SVG file with same units all the time, consistently, preferably in pixels as was the case with version 0.92.4.
Sample attachments
Above command is using this file:
Version Info:
- Inkscape Version: Inkscape 1.0 (4035a4fb49, 2020-05-01) Pango version: 1.43.0
- Operating System: Windows 10