How to manually scale to page-size with CLI?

Home Evil Mad Scientist Forums AxiDraw How to manually scale to page-size with CLI?

Tagged: , , ,

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #28905

    New to Axidraw but have the basics working. Have an A3 model.

    I want to use the CLI to go straight to the plotter (no Inkscape). I’m driving the Axidraw with a Pi4/Raspberrian. I have this generally working, but don’t understand how to scale any given SVG to the page size I want (A3 vs 8×11 vs maybe I want tiny). In Inkcape I would set page-size and visually confirm like a “print preview”, but in CLI I can’t find an option for setting scale. My graphics are often quite large and need to be resized to fit page height and width.

    Perhaps –model 2 does all of the scaling and sets all plots to A3? Viewport is not set in the SVG header of my current test file. The image is 1200×1600 and complex enough that Inkscape struggles/crashes with it (hence the desired use of the CLI to plot directly). But I’ve noticed in test runs (pen up or preview mode) that arm wants to print outside the plot area… i.e., the image is too big. That’s obviously not desirable or what I want — so I want to force the scale to something like 8×11 at the time I send it.

    Also could to pre-scale / set viewport with a command-line tool in advance — or convert to PDF if that lets me force scaling to a desired page-size.

    Thank you for any guidance

    Windell Oskay

    The model setting only sets the limits; it performs no scaling.

    When you set the page size and scaling in Inkscape, it is editing how those parameters are set in the SVG file itself. Most important are the width, height, and viewbox parameters.

    You haven’t said how you are creating the artwork. Normally, what you would do is to make the page the correct size in whatever environment you are using to create the artwork. If that’s Inkscape, you’ve already figured out how. If you are creating artwork in some other graphic environment, there are likely controls there to set the size. If you are creating things programmatically, you can edit how large the artwork is created within that process. And, if all else fails, you can edit the SVG directly within a text editor to set the size, or write a script to do so if you need to do the same thing repeatedly.

    There is also a CLI tool called vpype that is specially designed to perform operations like this.


    Hi Windell. Thank you for the response. I’m a little new to the intricacies of the SVG format and this helped.

    I am creating mostly in Processing with a variety of my own and other sketches, but the troublesome files are coming from modified versions of Scott Cooper’s pathfinding and gcode sketch:

    It makes some huge outputs sometimes, which can be troublesome for Inkscape on limited machines… so I’m exploring CLI which is simple and expedient.

    Height and Width is set for this particular file — I had thought it was in pixels but now I’m realizing it’s probably mm (and therefore very large). Viewport is definitely not set in these files.

    You’ve answered my question which is that it’s stored in the SVG itself. I’ll check out vpype which looks perfect for what I need, and play with directly adding/modifying the SVG tags.

    I guess I had kind of hoped I could do something like this with the CLI:

    axicli myfile.svg –resize 8.5in x 11in


    axicli myfile.svg –paper-size A4 –model 2

    You get the idea.

    Thank you!

    Windell Oskay

    Adding a direct feature for resizing is something that we have considered, but there are so many possible parameters (scaling vs cropping, centering or not, document size, margin sizes, orientation, etc) that it’s a little challenging to do so *well* without making the usage more cumbersome.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.