Inkscape.org
Beyond the Basics Need to remove the page/viewbox definition from a document
  1. #1
    Freezr Freezr @freezr

    Hi folks,

    I wonder if there is any command or tag to remove the page information directly from Inkscape or at least from the SVG file.

    I am playing with the internal XML editor but when I delete the viewport it is replaced by a bigger and default one.

    I am converting SVG data into METAPOST and the page information is not correctly interpreted by ConTeXt, therefore the images are misplaced in the PDF output.

    Thanks! 🙏

  2. #2
    inklinea inklinea @inklinea⛰️

    hmm, I think the Inkscape gui will always reestablish the viewBox if deleted.

    From an extension, it's fairly simple to pop the viewBox attribute and then save the svg string, but that would require a bit of python coding.

    From the command line, the best to my knowledge is to set viewBox="", not sure if you can remove the actual attribute though.

    inkscape --actions="select-by-selector:svg:root;select-list;object-set-attribute:viewBox,;export-do;" drawing.svg

    The root pseudo class is there in case you have nested svgs, you only want to affect the base svg tag.
     

  3. #3
    Freezr Freezr @freezr

    Thank you...

    Bo I do believe that I missed the real issue, I don't believe is the page/viewport anymore.

    When I clean the "plain SVG" with Scour I can easily remove the viewport however the conversion always got wrong, with my graphic that is shifted toward the bottom so the Y origin is equal minus the total height. I thought that changing the origin of the axis from top to the bottom would solve the issue but it didn't...

    I need to investigate this "issue" more... 🤔

Inkscape Inkscape.org Inkscape Forum Beyond the Basics Need to remove the page/viewbox definition from a document