Inkscape.org
Beyond the Basics Bulk import pdf pages (on Mac)
  1. #1
    plinyero plinyero @plinyero

    Hi all,

    Inkscape has become one of my new favorite pieces of free software, and the updates look great.

    However, when importing from a pdf using the GUI, it seems to require selecting each page number, one by one, repeating a series of dialog menus and interactions.

    In order to do this more efficiently, I've been exploring using scripting using the bash shell, as well as using the Inkscape shell options, but I have not had success.

    I am on macOS (10.13) using the version of Inkscape 1.0 that comes from the homebrew cask.

    Am I correct in believing that this was different on the previous version (0.92) that I had been using?

    I welcome any suggestions on more efficient ways to import all the pages from a given .pdf. Happy to try things out on the command line if necessary!

    Thanks :)

  2. #2
    plinyero plinyero @plinyero
    #!/bin/bash
    
    for ((i = 1; i<=2; i++)); do
        inkscape twopages.pdf --pdf-page=$i --export-filename=twopages.svg
    done
    
    
    

    By the way, this is what I have been trying as a script, but it appears that the second time through the loop I am just overwriting the result of importing "pdf-page=1" to the "twopages.svg" document.

    Am I correct in believing this is what the inkscape --shell option is for? So that you avoid re-running the the inkscape command? And you can just leave the document open for writing to until you need to close it?

    I just wish there were some examples of how to script using the shell option. I'm sure I'm doing just slightly wrong enough that someone out there can point out for me. Perhaps I should be posting this in the "Beyond the Basics" section?

     

    Thanks for any help!

  3. #3
    Tyler Durden Tyler Durden @TylerDurden

    Moved it for you.

  4. #4
    plinyero plinyero @plinyero

    @TylerDurden Thank you for that!

    Here's another example of something that failed:

    inkscape --actions="file-open:file1.svg;open-page:1;open-page:2;file-close" twopages.pdf which primarily resulted in the complaint that the document was empty.

    The idea here in pseudo-code--create a file(named file1.svg); open pages (from pdf file named twopages.pdf); close/save file1.svg

    I've been trying to hack together pieces of various stuff from https://inkscape.org/doc/inkscape-man100.html and from http://tavmjong.free.fr/INKSCAPE/MANUAL/html/CommandLine.html

    So far not much luck.

  5. #5
    Maggi G Maggi G @madgg

    @plinyero Did you ever figure out how to get it to work?

Inkscape Inkscape.org Inkscape Forum Beyond the Basics Bulk import pdf pages (on Mac)