Search code examples
pdfsvgcommand-lineexportinkscape

Changing DPI when exporting SVG to PDF with Inkscape (command line)


I have created a simple SVG file that has a high-resolution JPEG background and some text on top:

Now I would like to export it as PDF (keeping the text as-is, not converting it to an image).

I know I can do that with:

inkscape --export-type=pdf test.svg

The output file, however, is too large. So there is a DPI parameter that should, as I understand, set the resolution of the exported raster images.

However, no matters what value I use, it seems it has no effect on the exported file, which seems to have always the same size and the same background image resolution:

inkscape --export-type=pdf --export-dpi=96 test.svg

How can I export to PDF while reducing the exported resolution of the background (raster) image and keeping the text as-text?

Looking for a command line (automated) way, since I have many SVG files I would like to export. :-D


Solution

  • According to the documentation (https://inkscape.org/doc/inkscape-man.html#d-DPI---export-dpi-DPI), the dpi value is not used for embedded images, but only for rasterization of filters. You can make a feature request if you want any changes: https://inkscape.org/report.

    You could make a bitmap copy to reduce the resolution. Settings for bitmap copy resolution can be given in a preferences file that is handed to Inkscape on the command line.