I can't find how to open a new svg document with Inkscape, simply from the terminal.
If the document specified as argument (or via -f
) does not exist, there is just an error saying it doesn't exist, and then it opens an unsaved new document.
I tried using the verb FileSaveAs
like this for example:
inkscape --verb FileSaveAs mynewfile.svg
but FileSaveAs does not take arguments, it just opens the graphical window for this action.
I might be persnickety, but I would find it more convenient to be able to create a new file directly from the command line instead of having to launch this window and click to the right directory...
To my surprise, there seems to be no option in Inkscape to produce a new file from cli!
How to create the option?
As always, if it doesn't exist, it can be made:
Inkscape
, create a new filedrawing.svg
Copy the code below into an empty file, save it as
newinkscape
(no extension) in~/bin
. Create the directory if it doesn't exist yet.Make the script executable
Replace in the line:
The path by the path to your sample file.
Log out and back in, now:
will open a new empty
Inkscape
file, saved in the location you used in the command.Well, I've been wondering about this same thing for years (especially since
touch mynewfile.svg; inkscape mynewfile.svg
causesInkscapeApplication::document_open: Failed to open: /path/to/mynewfile.svg ; ConcreteInkscapeApplication::on_open: failed to create document!
) - and finally, after consulting https://wiki.inkscape.org/wiki/index.php/Using_the_Command_Line, I found it:For instance, to test under Ubuntu 18.04:
With Inskcape 1.0:
or, if you want, you can use a template for the new file: