PDF export with --export-area-drawing gives wrong canvas size (too big)

Bug #624775 reported by Rainer Finocchiaro on 2010-08-26
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Johan Engelen

Bug Description

"Bounding box" is calculated too big when trying to export an SVG drawing (which only partly covers a page) to a PDF file (using "Save Copy as..."-> PDF and setting the tick at "Exported area is complete drawing" or in German "Exportierter Bereich ist die gesamte Zeichnung").

Drawings were originally generated with 0.47. The problem depends on the drawing, that is, not all my drawings exhibit the same behaviour. Some get exported correctly in 0.48, some have only a bit of whitespace added, some lots of space. The added space appears always at the top of the drawing. Attached is a drawing that shows lots of space added together with the two export results (0.47 correct, 0.48 wrong).

The problem appears with the official version "Inkscape 0.48.0 r9654" for Windows on Windows 7, version "Inkscape 0.47 r22583, built Nov 21 2009" behaves correctly.

Best regards,

jazzynico (jazzynico) on 2010-08-26
tags: added: exporting regression
removed: export
Changed in inkscape:
importance: Undecided → Medium
su_v (suv-lp) wrote :

not reproduced with Inkscape 0.47,
reproduced with Inkscape 0.48 and 0.48+devel r9723 on OS X 10.5.8

tags: removed: regression
Changed in inkscape:
status: New → Confirmed
tags: added: regression
su_v (suv-lp) wrote :

Quick workaround in Inkscape 0.48: force a rewrite of the paths/objects SVG data

1) open sockets_tcp_flow.svg
2) select all (Ctrl+A)
3) move the selection with the cursor keys one step up and back down again
4) save a copy as PDF with 'export area is drawing'

Do you remember the original page size of the document or - if it was A4 - how you managed to move the layer 'Ebene 1' itself as a group (can't be done unless using the internal XML Editor)?

su_v (suv-lp) wrote :

The error is triggered by 2 paths with a preserved transform attribute (which seems ignored by Inkscape 0.48 when calculating the extent of 'drawing'):

     inkscape:label="Ebene 1"
       d="m 620.27385,131.10234 0,21.25984"
       transform="translate(19.823307,-701.09448)" />
       d="m 619.77362,187.79525 0,21.25985"
       transform="translate(19.823307,-701.09448)" />

Forcing a rewrite of the path data of the two paths (e.g. move one step up and back down) converts the preserved into optimized transforms (-> path data) and the extent of 'drawing' is correctly calculated on export to PDF.

The 2 paths possibly had been created on a newer layer (after resizing the page) and moved down to 'Ebene 1' or copied and pasted in place, with preferences set to store transforms in preserved mode.

I haven't yet succeeded to reproduce this bug in a new drawing (with nested preserved transforms on paths).

su_v (suv-lp) wrote :

Steps to reproduce (Inkscape 0.48):

1) open a new document
2) draw a line, apply end marker
3) resize page to content
4) save a copy as PDF (export area 'drawing')
-> export area correct

5) add new layer, draw line with end-marker
6) select new line and move it to the layer below
7) save a copy as PDF (export area 'drawing')
-> export area incorrect

8) select all
9) move selection a step up and back down
10) save a copy as PDF (export area 'drawing')
--> export area correct

The marker of a path with preserved transform causes the incorrect calculation of the export area.

su_v (suv-lp) wrote :

Same error happens when exporting 'Drawing' to bitmap.

tags: added: bitmap
su_v (suv-lp) wrote :

Cause of the regression (incorrect bbox for export [drawing|selection] if path with markers has preserved transform): improved bbox calculation, committed in

r9307 -> incorrect PDF export
- improve boundingbox calculation: include strokecaps.
- increasing boundingbox calculation precision for selection to marker, selection to pattern and fit canvas"

r9309 -> incorrect Bitmap export
- fix bug 166659. precisely calculate bbox when exporting to png

(tested and reproduced with archived builds r9300, r9307, r9317 on OS X 10.5.8)

su_v (suv-lp) wrote :

@Johan - any chance you could take a look at this regression? AFAICT (testing with archived builds) it is triggered by the changes for the improved bbox calculation (markers).

Changed in inkscape:
assignee: nobody → Johan Engelen (johanengelen)
milestone: none → 0.48.1
Changed in inkscape:
status: Confirmed → In Progress
Johan Engelen (johanengelen) wrote :

fixed in r9731

excellent research ~suv! helped me *a lot*!

Changed in inkscape:
status: In Progress → Fix Committed
jazzynico (jazzynico) on 2011-03-05
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers