-
I may just not be understanding the relationship between the viewbox and the image, but is there a way to basically do a "Zoom Page" (or actually perform that command)? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I've been looking into this, and it appears the answer is "no". An Inkscape SVG file represents the current zoom within a <sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="0.5" inkscape:cx="512" inkscape:cy="385" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="false" inkscape:window-width="1920" inkscape:window-height="1029" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="1" inkscape:document-rotation="0" inkscape:showpageshadow="2" inkscape:pagecheckerboard="0" inkscape:deskcolor="#d1d1d1"> <inkscape:grid type="xygrid" id="grid2816" empspacing="4" visible="false" enabled="true" snapvisiblegridlinesonly="true" spacingx="16" spacingy="16" originx="0" originy="0" units="px" /> </sodipodi:namedview> Although Simple Inkscape Scripting does not currently provide convenient access to named-view elements, a script can use lower-level APIs to access an SVG element's attributes. For example, the current zoom level can be read like this: nv = svg_root.namedview
zoom = float(nv.get('inkscape:zoom')) The following code ought to set the zoom, but in fact has no effect: nv = svg_root.namedview
nv.set('inkscape:zoom', '1.2345') (Even if that did work, you'd still have to compute the zoom level corresponding to "Zoom Page" in terms of the window and page sizes. There's no automatic sizing that I know of.) Interestingly, modifying many of the other |
Beta Was this translation helpful? Give feedback.
-
Interesting. I was thinking I was just missing something so I'm glad to find out there is more to it than I originally thought! Thanks for the quick response! |
Beta Was this translation helpful? Give feedback.
I've been looking into this, and it appears the answer is "no".
An Inkscape SVG file represents the current zoom within a
sodipodi:namedview
element'sinkscape:zoom
attribute, as in the following: