PDF export from command line: --export-area and --export-id

Post questions on how to use or achieve an effect in Inkscape.
iliis
Posts: 1
Joined: Fri Aug 15, 2014 4:00 am

PDF export from command line: --export-area and --export-id

Postby iliis » Fri Aug 15, 2014 4:35 am

Hi all,

I'd like to export a specific area of my SVG to a PDF and I'd like to automate it from the command line.
My issue is that Inkscape can only export the whole page or drawing, or a single object (and only this object).

Things I tried but don't work:


  • Code: Select all

    --export-pdf=filename.pdf
    ignores

    Code: Select all

    --export-area=x1:y1:x2:y2
    completely and always exports the whole page or drawing.

  • Using

    Code: Select all

    --export-id=objectid
    works, but it only exports the specified object, i.e. Inkscape acts like

    Code: Select all

    --export-id-only
    is set. This is the same behaviour I see when I use the GUI to export a PDF and restrict export to an object ID.

Both of these (--export-area and --export-id) work as intended when exporting a PNG.

The only method that does work is actively changing the page area:

Code: Select all

cp $svg_file $tmp_svg_file
inkscape --select=$object_id --verb=FitCanvasToSelection --verb=FileSave --verb=FileClose --verb=FileQuit $tmp_svg_file
inkscape --export-pdf="$exported_file" "$tmp_svg_file"
rm $tmp_svg_file


Unfortunately, this is slow as the whole Inkscape GUI has to be started first. The actual PDF export (the second call to Inkscape above) only takes half a second while simply changing the page area takes about 7 seconds and quickly flashes a window.

I also tried a current nightly build (0.91 r13322) without success :(

cheflo
Posts: 8
Joined: Fri May 27, 2016 4:27 am

Re: PDF export from command line: --export-area and --export-id

Postby cheflo » Sat Nov 19, 2016 2:48 am

Hi,
I would also like to automate the export of specific areas of my Inkscape SVGs to PDFs. Did you ever find a solution to this, other than the slow one you outlined?


Return to “Help with using Inkscape”