Custom stripe pattern breaks pdf export

Bug #486259 reported by Filippo Argiolas
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Inkscape
Triaged
Medium
Unassigned

Bug Description

I'm trying to export the attached svg drawing to a pdf file. It seems to work but when I open it with evince hard disk starts spinning, cpu usage becomes huge and I'm not able to do anything else.
Xpdf can open the file but doesn't render any pattern.

The only way I found to fix it is to replace the striped patterns with solid filling.
The custom pattern has been created merging a solid grey rectangle with a 30% transparent stripe 1:1 pattern.

Revision history for this message
Filippo Argiolas (fargiolas) wrote :
su_v (suv-lp)
tags: added: exporting pattern pdf
Revision history for this message
Filippo Argiolas (fargiolas) wrote :
Revision history for this message
su_v (suv-lp) wrote :

reproduced with Inkscape 0.46+devel r22575 on OS X 10.5.8

locally created and above attached PDF display without error in Apple's native PDF viewer 'Preview.app', but crash in gs 8.70 and gv 3.6.7 with attached error messages

Changed in inkscape:
status: New → Confirmed
Revision history for this message
su_v (suv-lp) wrote :
Revision history for this message
Filippo Argiolas (fargiolas) wrote :

I tried to open the pdf file with acroread on linux and it works fine, doesn't render the pattern exactly as I see it in inkscape, but doesn't crash nor blocks. So, probably evince is involved too.

Revision history for this message
Adrian Johnson (ajohnson-redneon) wrote :

The problem with the PDF files is a large number of the objects have the bounding box:
/BBox [ 0 0 25500 13000]

so evince tries to create a cairo surface 25500x13000 pixels at 4 bytes/pixel = 1.3GB. It soons runs out of memory.

Revision history for this message
Adrian Johnson (ajohnson-redneon) wrote :

I'm attaching a cairo trace of inkscape -A volta.pdf volta-stripes.svg

Searching for "25500" in the trace shows that Inkscape is calling cairo_surface_create_similar with the size 25500x13000 points. The PDF is created with the page size 272x232 points.

This looks like a bug in Inkscape.

su_v (suv-lp)
Changed in inkscape:
importance: Undecided → Medium
Revision history for this message
su_v (suv-lp) wrote :

Same in EPS export, but neither gs 8.70 nor gv 3.6.7 on osx crash - they don't show any custom pattern however.
Snip of EPS source:

%%Page: 1 1
%%BeginPageSetup
%%PageBoundingBox: 0 -415 272 233
%%EndPageSetup
q
/CairoPattern {
  q
  0 0 25500 13000 rectclip
  Q
} bind def
<< /PatternType 1
   /PaintType 1
   /TilingType 1
   /XStep 25500 /YStep 13000
   /BBox [0 0 25500 13000]
   /PaintProc { CairoPattern }
>>

Revision history for this message
su_v (suv-lp) wrote :

possibly related:
Bug #425529 “PS/EPS export fails when using pattern”: (status: 'Confirmed'
<https://bugs.launchpad.net/inkscape/+bug/425529>
Bug #168610 “Exporting patterns and gradients doesn't work for PDF / EMF”: (status: 'Fix Released')
<https://bugs.launchpad.net/inkscape/+bug/168610>

Revision history for this message
Mahendra Tallur (mahen) wrote :

I'm pretty sure I encounter the same bug ; here's a pattern applied to a simple polygon which, when saved as a PDF, makes evince eat memory & crash. It's displayed properly under Acrobat Reader, and apparently also when using the "splash" libpoppler backend.

[FYI, I also attached this very same file to another bugreport, as it also triggers a huge memory leak in inkscape, filling my 4 GB of memory within a minute when zooming. https://bugs.launchpad.net/inkscape/+bug/706294 ]

Revision history for this message
Mahendra Tallur (mahen) wrote :

Hmm, this is pretty weird. I recently switched to Archlinux + KDE 4.6, with libpoppler 0.14.5 --> the Okular PDF reader displays those PDF properly with no delay.

Which makes me wonder is those PDF are actually broken.

Revision history for this message
jazzynico (jazzynico) wrote :

Reproduced on Debian testing, Inkscape trunk revision 11943 and Evince 3.4.0.
Opens and renders correctly with Acrobat Reader 9.5.1.

Changed in inkscape:
status: Confirmed → Triaged
Revision history for this message
markgalassi (mark-galassi) wrote :

I can confirm that on debian unstable I get the evince crash from an inkscape-produced pdf file. I pushed it a bit further and found that:

1. if I use the pdf2pdf script here: https://github.com/marten/dotfiles/blob/master/bin/pdf2pdf
to try to clean it up I can clean up the derived latex document so that evince works on it, but interestingly the pdf file straight out of inkscape's command line export crashes pdf2pdf!

2. on an ubuntu 14.10 machine evince is slow and puts out reports of incorrect pdf, but it doesn't crash

markgalassi@mozart:~/h/misc/teaching/hackingcamp/teacher-manual$ dpkg -l inkscape
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-========================-=================-=================-======================================================
ii inkscape 0.48.5-3 amd64 vector-based drawing program
markgalassi@mozart:~/h/misc/teaching/hackingcamp/teacher-manual$ dpkg -l evince
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-========================-=================-=================-======================================================
ii evince 3.14.1-2 amd64 Document (PostScript, PDF) viewer

Interestingly the pdf2pdf thing which makes it fail is that it runs gs under the hood like this:

markgalassi@mozart:~/h/misc/teaching/hackingcamp/teacher-manual$ gs -dCompatibilityLevel=1.2 -q -dNOPAUSE -dSAFER -sDEVICE=pdfwrite -sOutputFile=software-layers-clean.pdf software-layers.pdf
Segmentation fault
markgalassi@mozart:~/h/misc/teaching/hackingcamp/teacher-manual$

but if I don't use the CompatibilityLevel=1.2 option then gs works fine.

I'm attaching the svg file and the Makefile rule I use to get the PDF file is:

%.pdf: %.svg
 inkscape --export-pdf=$@ $<

for my own purposes I will exploring using tikz output for my latex documents, but I thought this might help with the bug reports. I'd conclude that it's a problem with both inkscape (which is doing some funky stuff with textures in the pdf file) and with evince (which shouldn't crash!)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.