Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pandoc Does Not Recognize Image Size of Inkscape SVGs #3579

Closed
schrieveslaach opened this issue Apr 16, 2017 · 3 comments · Fixed by #3580
Closed

Pandoc Does Not Recognize Image Size of Inkscape SVGs #3579

schrieveslaach opened this issue Apr 16, 2017 · 3 comments · Fixed by #3580

Comments

@schrieveslaach
Copy link
Contributor

The development version of pandoc does not recognize SVG images create by Inkscape. Inkscape puts the xml declaration and some comments in front of the <svg> tag, for example:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->

<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:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   width="101.33541mm"
   height="67.317558mm"
   viewBox="0 0 101.33541 67.317558"
   version="1.1"
   id="svg8"
   inkscape:version="0.92.1 r"
   sodipodi:docname="Zeichnung.svg">
  <defs
     id="defs2" />
  <sodipodi:namedview
     id="base"
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1.0"
     inkscape:pageopacity="0.0"
     inkscape:pageshadow="2"
     inkscape:zoom="0.35"
     inkscape:cx="-178.5"
     inkscape:cy="-284.21429"
     inkscape:document-units="mm"
     inkscape:current-layer="layer1"
     showgrid="false"
     fit-margin-top="0"
     fit-margin-left="0"
     fit-margin-right="0"
     fit-margin-bottom="0"
     inkscape:window-width="1920"
     inkscape:window-height="1046"
     inkscape:window-x="1680"
     inkscape:window-y="0"
     inkscape:window-maximized="1" />
  <metadata
     id="metadata5">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
        <dc:title></dc:title>
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <g
     inkscape:label="Ebene 1"
     inkscape:groupmode="layer"
     id="layer1"
     transform="translate(-3.3828868,-7.8293156)">
    <rect
       style="opacity:1;fill:#c70000;fill-opacity:1;stroke:#000000;stroke-width:0.79374999;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
       id="rect10"
       width="55.940475"
       height="19.654762"
       x="3.7797618"
       y="8.2261906" />
    <rect
       style="opacity:1;fill:#0000c8;fill-opacity:1;stroke:#000000;stroke-width:0.79374999;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
       id="rect12"
       width="75.595238"
       height="32.505951"
       x="28.726189"
       y="15.029762" />
    <ellipse
       style="opacity:1;fill:#00d500;fill-opacity:1;stroke:#000000;stroke-width:0.79374999;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
       id="path14"
       cx="41.955357"
       cy="51.693451"
       rx="22.300594"
       ry="23.056549" />
  </g>
</svg>

Pandoc complain with a warning message (could not determine image type):

[warning] Could not determine image size for 'Zeichnung.svg': could not determine image type

Pandoc does not complain when the image does not contains the xml declaration and comments:

<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:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   width="101.33541mm"
   height="67.317558mm"
   viewBox="0 0 101.33541 67.317558"
   version="1.1"
   id="svg8"
   inkscape:version="0.92.1 r"
   sodipodi:docname="Zeichnung.svg">
  <defs
     id="defs2" />
  <sodipodi:namedview
     id="base"
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1.0"
     inkscape:pageopacity="0.0"
     inkscape:pageshadow="2"
     inkscape:zoom="0.35"
     inkscape:cx="-178.5"
     inkscape:cy="-284.21429"
     inkscape:document-units="mm"
     inkscape:current-layer="layer1"
     showgrid="false"
     fit-margin-top="0"
     fit-margin-left="0"
     fit-margin-right="0"
     fit-margin-bottom="0"
     inkscape:window-width="1920"
     inkscape:window-height="1046"
     inkscape:window-x="1680"
     inkscape:window-y="0"
     inkscape:window-maximized="1" />
  <metadata
     id="metadata5">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
        <dc:title></dc:title>
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <g
     inkscape:label="Ebene 1"
     inkscape:groupmode="layer"
     id="layer1"
     transform="translate(-3.3828868,-7.8293156)">
    <rect
       style="opacity:1;fill:#c70000;fill-opacity:1;stroke:#000000;stroke-width:0.79374999;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
       id="rect10"
       width="55.940475"
       height="19.654762"
       x="3.7797618"
       y="8.2261906" />
    <rect
       style="opacity:1;fill:#0000c8;fill-opacity:1;stroke:#000000;stroke-width:0.79374999;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
       id="rect12"
       width="75.595238"
       height="32.505951"
       x="28.726189"
       y="15.029762" />
    <ellipse
       style="opacity:1;fill:#00d500;fill-opacity:1;stroke:#000000;stroke-width:0.79374999;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
       id="path14"
       cx="41.955357"
       cy="51.693451"
       rx="22.300594"
       ry="23.056549" />
  </g>
</svg>
@jgm
Copy link
Owner

jgm commented Apr 16, 2017

I suspect #3462 may have fixed this.

@jgm
Copy link
Owner

jgm commented Apr 16, 2017

Oh, sorry, I missed that you were using the dev version.
@mb21 do you want to take a look [edit: never mind, see below]?

@jgm
Copy link
Owner

jgm commented Apr 16, 2017

Oh, I also missed that you'd submitted a PR already, sorry!

@jgm jgm closed this as completed in #3580 Apr 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants