CLI: Correct support for --export-margin

We have complex problems with --export-margin option:

  • Add support for PNG, EPS, EMF, WMF.
  • Fix support for SVG (#1022 (closed)).
  • Make PDF and PS support document unit based (PDF is hard coded to mm, PS is hard coded to px).
  • Pay attention on combinations with --export-area-drawing, --export-area, --export-id, --export-use-hints.

Steps to reproduce:

  • Download sample file: square.svg [100×100px]
  • Run these commands:
inkscape --export-margin=100 --export-filename=export-margin.png square.svg # unsupported
inkscape --export-margin=100 --export-filename=export-margin.svg square.svg # buggy
inkscape --export-margin=100 --export-filename=export-margin.pdf square.svg
inkscape --export-margin=100 --export-filename=export-margin.ps  square.svg
inkscape --export-margin=100 --export-filename=export-margin.eps square.svg #unsupported
inkscape --export-margin=100 --export-filename=export-margin.emf square.svg #unsupported
inkscape --export-margin=100 --export-filename=export-margin.wmf square.svg #unsupported
# for reference
inkscape --export-filename=export-square.pdf square.svg
inkscape --export-filename=export-square.ps  square.svg

What happened?

  • PNG export is unsupported: there is no margin.
  • SVG export is supported but buggy: See #1022 (closed).
  • PDF export: export-margin.pdf [226×226 mm] adds 100 margin but in millimeter (See export-square.pdf for reference).
  • PS export: export-margin.ps [300×300px] Works as expected in this case! (See export-square.ps for reference).
  • EPS export is unsupported: there is no margin.
  • EMF export is unsupported: there is no margin.
  • WMF export is unsupported: there is no margin.

What should have happened?

Exported files should be same as PS export above.

  • PNG export: add support.
  • SVG export: #1022 (closed).
  • PDF export: Hard coding to mm is a documented feature, but I think it is a bad design. The unit should be the document unit: if document is px based then px, it document is mm based then mm...
  • PS export: Documentation says that PS export is millimeter based but not, it is hard coded to px. Test with this file: square2.svg [100×100mm]
  • EPS export: if #1074 is fixed, this can be supported too.
  • EMF export: add support.
  • WMF export: add support.

Combination with other options

  • --export-margin + --export-area-drawing: currently does not work
  • --export-margin + --export-area=x0:y0:x1:y1: currently --export-area supports only PNG, no common set yet
  • --export-margin + --export-id: It works!
  • --export-margin + --export-use-hints: --export-use-hints is PNG only function, no common set yet

Inkscape Version and Operating System:

  • Inkscape Version: Inkscape 1.1-dev (36e1d049, 2020-03-13)
  • Operating System: Ubuntu
  • Operating System version: 19.10
Edited by Gyuris Gellért
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information