Inkscape.org
Creating New Extensions Is there a way to automate the batch export in Inkscape?
  1. #1
    optimystery optimystery @optimystery

    I was able to use a shellscript to open all pdfs from a folder and save to svg like:

    # Convert the PDF to SVG (basic conversion)
        "$INKSCAPE_PATH" --file="$pdf_file" --export-plain-svg="$SVG_DIR/$filename_no_ext/$filename_no_ext.svg"
    

    But what I need to do is export individual paths as separate svg files, in a folder with the filename (the opening, saving to named folder part is working through the shell script).

    Is there a way to script selecting the 'batch export' option, with 'svg' setting?

    Right now I can: Open multiple pdf files from a folder, save each one as svg in a folder created and named the filename

    What I want to do: Open multiple pdf files from a folder, save each path from that file as a separate svg in a folder created and named the filename

    I can achieve this manually using the batch export dialog, but I want to iterate through many files quickly.

    I had a look at the Inkscape scripting documentation but couldn't find anything that referred to scripting at this level.

  2. #2
    inklinea inklinea @inklinea⛰️

    I think it would have to be done in two steps.

    Convert all svg ---> PDF.

    Then process those svg files. 

    I would create a huge text file with an action string on each line, one for every operation.

    Then feed that into inkscape shell mode. Shell mode is a special mode which can process actions without having to reload Inkscape each time.

  3. #3
    optimystery optimystery @optimystery

    The files are already pdf. This is easy enough to batch process.

    What would an action string look like to:
    open pdf in inkscape
    select all
    ungroup
    select batch export as svg paths
    create folder with file name
    export multiple svg files from the pdf into that newly created folder

     

  4. #4
    inklinea inklinea @inklinea⛰️

    I meant pdf ---> svg

    Which OS / scripting language do you want to use. 

    bash / powershell / python ? 

  5. #5
    optimystery optimystery @optimystery

    Bash or python.
    If I know the parameters available and what Inkscape can do, I can get help with syntax from a robot friend!

Inkscape Inkscape.org Inkscape Forum Creating New Extensions Is there a way to automate the batch export in Inkscape?