With the Inkscape GUI it would be the following procedure:
1. start Inkscape GUI
2. load the SVG file
3. Page Properties (Shift+Ctrl+D)
4. resize page to content
5. save the SVG file
6. exit Inkscape
However, starting Inkscape GUI takes too long... and it should be automated in a batch process for many files.
There is the Inkscape command line, but it seems I don't know how to use the option "-D" --export-area-drawing properly.
Whereas
Code: Select all
inkscape -f FileName.svg -D -e FileNameCrop.png
Code: Select all
inkscape -f FileName.svg -D -l FileNameCrop.svg
Ok, then let's try another approach. As I understand, with the command line
Code: Select all
inkscape -S FileName.svg
However, as I understand it's not sufficient to simply change the coordinates of the SVG entry, because in Inkscape I don't get a page size which fits the content.
Code: Select all
<svg width="210mm" height="297mm"
viewBox="200 200 21000 29700"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.2" baseProfile="tiny">
Does anybody know about a Python-Script to do the proper changes or at least can me point to the right information sources which part of the SVG needs to be modified and how?
Other than a Python script wouldn't help me too much because I need to couple it to another software where Python is already available.
In the end, it probably would be even better to completely avoid the start of Inkscape and do it completely in Python?
Thank you for any hints.