Howto adjust papersize, to fit drawing (no border)?

Asked by private_lock on 2018-10-06


In Inkscape I had to take notes of all object-coordinates, find the smallest negative and the biggest positive number for each dimension and not mess up the different units. Now I resized my "paper" in shift-crtl-D. Then I select all my objects and move them until it seems to fit inside (object properties don't show a bounding-box of all selected?).

Strange enough (0,0) in object-properties is not necessarily a corner of the paper and the width and hight unit used is always stuck to mm though I switched everything else to px.

Is there an easier way? In Gimp I can easily adjust the canvas-size to fit either my layer(s) or crop it to a selection. I'd love to see a possibility to create a new Inkscape document by loading a JPG and getting the papersize set to a snug-fit of the JPG content.

Question information

English Edit question
Inkscape Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:
Hachmann (marenhachmann) said : #1

> Strange enough (0,0) in object-properties is not necessarily a corner of the paper

0,0 is always in the bottom left corner in Inkscape 0.92.3 (for the ruler and the document coordinate system)

For object positions that you can read in the SVG source code, this can be different, depending on the coordinate system that is used by the container(s) the object is in (e.g. a layer or a group).

You can resize the page to the selection (or drawing, if nothing is selected) with Edit > Resize page to selection. You shouldn't get any margins, if there are none set in the File > Document properties dialog.

A bounding box is usually shown for all selected objects. Make sure you're using the selection tool. Double-click on its icon for its settings.

What is 'in object properties'? There are no coordinates shown in that dialog at all. Do you mean in the XML (or the SVG source code)? If you want to change the unit there, either start with a template in the correct unit, or follow the steps outlined here:

private_lock (private-lock) said : #2

The jpg has "picture-properties" and "object-properties" in it's context menu (my translation back from German).

The "fit paper to selection" is exactly what I was looking for ... strange that I didn't see it ... maybe a bit too late in the night.

OK, I now started reading the xml output to understand what's going on.

Adding a jpg via drag&drop, an invisible layer is created around it. It won't show up in the interface until you save, close and reload the file. Then everything is magically wrapped in a group, that can be removed now. Ironically this group always got a bogus transform whose effect I had to undo for each item. Only then setting coordinates to (0,0) will align with the lower left corner of the paper. Looking at the xml, this is only approximately, as there seem to be rounding issues.

BTW. The xml-output of inkscape is suboptimal to compare to previous version, as it randomly shuffles the attributes around. Did you ever think of sorting them for a canonical output?