Im using python to draw simple graphics. However, as I would like to print the graphics as A4 pages with my printer, Im looking for a way to automatically generate new pages from a python script. Has anyone done this before and can help me? ย I have tried using the inkex library without any luck.ย
Thank you so much for your help ! I'll consider modifying it :) ย My last step is to figure out how to run this directly from python as a plugin/import.ย
Yes, Im able to run python, but I need to be able to run the script from another python script with inputs etc. ย
Now I'm importing the script (using import xx as abc). I need to be able to give a svg filename as input to the extension script (and some additional parameters) and then get the changed file as output.ย
Im using python to draw simple graphics. However, as I would like to print the graphics as A4 pages with my printer, Im looking for a way to automatically generate new pages from a python script. Has anyone done this before and can help me? ย I have tried using the inkex library without any luck.ย
ย
There is an example ( a zipped extension attached to my post ) here.ย https://inkscape.org/it/forums/questions/how-to-put-each-imageobject-into-a-separate-page-and-image-fit-the-page/
One change I would make is to add the offset to the 2nd page to avoid overlapping.
Thank you so much for your help ! I'll consider modifying it :) ย My last step is to figure out how to run this directly from python as a plugin/import.ย
Something like:
Create a new venv in python
Activate that venv, and use pip to install Inkex.
Something like:
Create a new venv in python
Activate that venv, and use pip to install Inkex.
Yes, Im able to run python, but I need to be able to run the script from another python script with inputs etc. ย
Now I'm importing the script (using import xx as abc). I need to be able to give a svg filename as input to the extension script (and some additional parameters) and then get the changed file as output.ย
ย
It's not really an extension if you don't use the main Inkscape program :)
If you want to completely avoid the Inkscape main program and just use inkex in python.
You can load svgs using the load function.
This script ( inkex standalone ) shows how to load svg files from a folder:
https://inkscape.org/forums/beyond/trim-whitespace-from-svg-command-line/