user1782634
user1782634

Reputation: 187

How to command line extract svg from pdf using inkscape?

Is there a command line option for asking inkscape to extract svg from pdf page 3 (for example)? The command I use now is

$ inkscape -f test.pdf -l test.svg

but I would like also the option to export a specific page from this pdf.

Upvotes: 1

Views: 1153

Answers (1)

alephreish
alephreish

Reputation: 540

What about extracting the page you need with pdftk (or in fact, any other suitable tool) first:

mypage=$(mktemp -u XXXXXX.pdf)
pdftk test.pdf cat 3 output "$mypage"
inkscape -l test.svg "$mypage"
rm "$mypage"

(It would be nice to be able to pipe the output from pdftk directly to inkscape. Unfortunately, when provided from stdin, data are expected by inkscape to be svg. A named pipe doesn't help either, because inkscape seems to attempt to traverse pdf files more than once.)

Upvotes: 2

Related Questions