4

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...

  • touch mynewfile.svg; inkscape mynewfile.svg? – muru Dec 14 '16 at 11:28
  • I thought about that, but a totally empty svg file causes an error. – PlasmaBinturong Dec 14 '16 at 12:33
  • Hi @PlasmaBinturong posted. Please mention if all is clear. – Jacob Vlijm Dec 14 '16 at 14:46
  • @JacobVlijm yep very clear thank you, I guess I will work with that for now. Don't know if the developpers have their reasons for this behavior, but maybe that's worth submitting a bug report? – PlasmaBinturong Dec 14 '16 at 15:03
4

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:

  1. Open Inkscape, create a new file drawing.svg
  2. Save this file anywhere
  3. 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.

    #!/bin/bash
    
    sample="/path/to/drawing.svg"
    dr=$1
    
    cp "$sample" "$dr"
    inkscape "$dr"
    

    Make the script executable

  4. Replace in the line:

    sample="/path/to/drawing.svg"
    

    The path by the path to your sample file.

Log out and back in, now:

newinkscape /path/to/newfile.svg

will open a new empty Inkscape file, saved in the location you used in the command.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.