Import non-SVG from the CLI
Problem
I can not use Inkspace CLI to convert PDF on stdin to SVG on stdout. Specifically, the command
inkscape --pipe --export-type=svg < foo.pdf > foo.svg
fails with an error:
Entity: line 1: parser error : Start tag expected, '<' not found %PDF-1.5 ^ ink_file_open: cannot open file in memory (pipe?) InkscapeApplication::document_open: Failed to open memory document. ConcreteInksacpeApplication::on_activate: failed to created document!
Use Case
Why use conversions in this way?
-
Editing a PDF by manipulating SVG (maybe with Inkscape, but also with other tools) requires symmetric conversions in both directions. Inkscape has, for me, proven to provide the best conversion (previously with
-A
and-l
). -
Pipes and redirections are commonly used in shell scripts, so this would enable more flexible use of Inkspace in scripts.
-
When installing Inkscape as Snap (or, presumably, a similarly sandboxed version; I've had reports on macOS as well), Inkscape can not access all locations the user can (e.g.
/tmp
), further limiting the use of file-based CLI commands; pipes and redirections still work!
Proposal
Add the equivalent type option for import:
inkscape --pipe --import-type=pdf --export-type=svg < foo.pdf > foo.svg
should correctly read the PDF from stdin, convert to SVG, and write to stdout.