Inkscape.org
Beginners' Questions Scaling to fit page when saving to pdf?
  1. #1
    j4nd3r53n j4nd3r53n @j4nd3r53n

    I've made a large drawing - typical dimensions are in meter, and I want to save it into a PDF file; however, it seems like the only two options are to use the document's size (ie A4) or the object's size. Using the first produces a PDF page with just a very large bit of a detail, and using the other creates a PDF document with a page size measured in several meters. Is there a way to shrink part of a drawing to fit, while saving to pdf? For example, if there was an 'output page': a sort of frame in the same aspect ratio as the chosen paper format, but which could be stretched to cover the part of the drawing you wanted to include in your print document.

  2. #2
    Patrick Storz Patrick Storz @Ede_123

    The easiest solution would obviously be to set page size as required and scale your drawing accordingly.

    If this does not solve your issue, you need to clarify your requirements a bit.

  3. #3
    Tyler Durden Tyler Durden @TylerDurden

    Just thinking out loud... I haven't tried this myself.

    If all of the objects can be put in a group, I'd clone the group and scale that clone to fit the desired area to A4.

    Then I could still work at full scale and use the clone as my output size.

    If I'm using layers, that's a little more complicated, but it can be done.

     

    TD

  4. #4
    j4nd3r53n j4nd3r53n @j4nd3r53n
    *

    Patrick, my requirement is to be able to draw at full scale - in this case a floorplan for a house. Doing it this way means I can easily measure real distances, for example, and everything relates directly to the physical dimensions. Saving it as PDF is just for printing or emailing to eg. the planning authority.

     

    Tyler - I think that may be the best compromise although not ideal. I'm still new to inkscape - is there such a thing as extensions? If so, maybe it is possible to add this functionality.

  5. #5
    Patrick Storz Patrick Storz @Ede_123

    I see, so basically your SVG file includes content in real-world physical units and you want to scale it down to A4 for preview.

    I can see a few solutions:

    • The easiest (if you have suitable software available) could be a PDF printer with a scaling option (i.e. print in original size and scale down in the printer driver)
    • A solution with some manual effort (that works in 0.92.x) if you know XML could be to embed the original SVG in a second file using the <use> tag and scale that as required (similar to Tyler's solution but does not need a clone in the same document
    • An equivalent solutions (that requires a development version) is to exploit the same technique, but here you can just drag/drop the SVG into another document and choose "embed", then rescale visually.
  6. #6
    j4nd3r53n j4nd3r53n @j4nd3r53n

    Thank you, Patrick. Interesting - I'll see if there is PDF printer option for Linux with scaling.

  7. #7
    flixus flixus @flixus

    I too have a floor plan in real scale (7000 x 14000 mm). Inspired by Patrick's suggestion, I found a solution that doesn't require XML editing, or knowing the SVG schema. But first, I ran into these issues:

    • Using the use tag as suggested was a non-starter. I couldn't even get the original file to render at all, in Chrome. Probably some mistake or another on my end, but avoid this if you don't want to risk getting stuck on figuring out some detail.
    • Printing the file as vector. Attempting to print 1 page froze up inkscape after it quickly used all my 26 GB of available memory. I had to struggle to kill inkscape on a sluggish computer.
    • Importing the source file as is in inkscape. Inkscape consistently crashed with a dialog saying inkscape would close now.

    That said, the actual solution went smoothly:

    1. Create floor plan with real dimensions, floorplan.svg
    2. Document properties page size is now a custom size of something like width 7000 and height 14000 with unit being mm.
    3. Change page size to A4 and save (or inkscape will crash in step 7).
    4. Create a new document called floorplan_A4.svg, with page size set to A4 obviously.
    5. Open Windows Explorer and drag floorplan.svg onto the empty page in floorplan_A4.svg.
    6. An SVG Input dialog appears!
    7. Choose "Link the SVG file in a image tag (not editable in this document) and OK.
    8. Save and close floorplan_A4.svg.
    9. Change page size of floorplan.svg back to your custom size, perhaps using "Resize page to drawing or selection (Ctrl+Shift+R)".
    10. Save.
    11. Open floorplan_A4.svg in Chrome. Everything should be there, in A4 size :)
    12. Printing from Chrome worked like a charm. Much better quality than the exported PNG file I tried as a workaround instead of this workaround.

    Alternatively, just store the following as floorplan_A4.svg (I've removed the inkscape specific stuff to keep the size here down):

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>

    <svg
       width="210mm"
       height="297mm"
       viewBox="0 0 210 297"
       version="1.1"
       id="svg5"
       xmlns:xlink="http://www.w3.org/1999/xlink"
       xmlns="http://www.w3.org/2000/svg"
       xmlns:svg="http://www.w3.org/2000/svg">
      <defs
         id="defs2" />
      <g
         id="layer1">
        <image
           preserveAspectRatio="none"
           width="210"
           height="297"
           xlink:href="floorplan.svg"
           id="image1270"
           x="0"
           y="0" />
      </g>
    </svg>

  8. #8
    flixus flixus @flixus

    Ah, the aspect ratio is messed up, sorry not noticing that before posting. I don't know if this can be solved without editing the XML, but it's a fairly trivial change.

    Change the line with preserveAspectRatio="none" to:

           preserveAspectRatio="xMidYMid"
     

Inkscape Inkscape.org Inkscape Forum Beginners' Questions Scaling to fit page when saving to pdf?