Bug 40076

Summary: Use PostScript patterns in tilingPatternFill
Product: poppler Reporter: Adrian Johnson <ajohnson>
Component: generalAssignee: poppler-bugs <poppler-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: output tiling patterns ising PS patterns
don't use patterns when only one instance is used
print output from firefox
output PDF

Description Adrian Johnson 2011-08-14 05:50:26 UTC
tilingPatternFill in PSOutputDev uses Type 3 fonts to output a PDF tiling pattern. This is fine for PS Level 1 but for PS Level 2 or higher it is more optimal to use PostScript patterns.

One problem with using Type 3 fonts for PDF tiling patterns is if the PS is converted back to PDF, some PDF viewers (including acroead) do not display the patterns.
https://bugs.launchpad.net/ubuntu/+source/ghostscript/+bug/817049
Comment 1 Adrian Johnson 2011-08-14 05:52:28 UTC
Created attachment 50197 [details] [review]
output tiling patterns ising PS patterns 

This patch makes PSOutputDev::tilingPatternFill output a PS Pattern when the PS level is 2 or higher.
Comment 2 Adrian Johnson 2011-08-14 05:56:23 UTC
Created attachment 50198 [details] [review]
don't use patterns when only one instance is used

This optimization avoids the use of PS patterns or Type 3 fonts when the only one copy of the pattern used to fill the clip region.

This make webpages containing images printed with firefox to print faster on my printer.
Comment 3 Albert Astals Cid 2011-08-16 14:56:37 UTC
Can you please attach a pdf file that shows the need of this change?
Comment 4 Adrian Johnson 2011-08-16 15:17:51 UTC
Created attachment 50285 [details]
print output from firefox

Attached is sample print output from firefox (firefox now prints to CUPS in PDF format).

The problem can be reproduced by printing from firefox to CUPS-PDF. The equivalent manual steps are to convert to firefox PDF to PS with pdftops then back to PDF with ps2pdf. Then view the resulting PDF in evince and acroread.

The second patch also fixes a printing this PDF to a Brother HL-5350DN (PS error instead of the page content). The problem appears to be the HL-5350DN doesn't like images inside a procedure - either in Type 3 fonts or Patterns. I haven't been able to work out yet if it is a bug in the printer or the pdftops output.
Comment 5 Adrian Johnson 2011-08-16 15:20:02 UTC
Created attachment 50286 [details]
output PDF

This is the PDF file resulting from:

pdftops firefox.pdf
ps2pdf firefox.ps firefox2.pdf

When viewed in evince or acroread the images are black.
Comment 6 Albert Astals Cid 2011-08-18 03:23:54 UTC
Will be there in poppler >= 0.17.3
Comment 7 Till Kamppeter 2011-08-18 09:07:49 UTC
In Ubuntu (Oneiric, 11.10) we are using Poppler 0.16.7. Can one of you, Adrian or Albert, backport the patches to  Poppler 0.16.7? Thanks.
Comment 8 Albert Astals Cid 2011-08-18 09:29:30 UTC
The 0.16.x branch is dead, sorry.
Comment 9 Adrian Johnson 2011-08-18 14:20:08 UTC
Till,

the patches are a60e61ac and 7741b24d. I don't think the code they touch has changed in the last few months so I suggest trying the patches with 0.16.7 to see if they work.
Comment 10 Till Kamppeter 2011-08-19 06:40:19 UTC
I have looked through the patch and there are really changes (introduction of cat and pmat arguments to the tilingPatternFill() function), but I succeeded to backport the patch and it leads to the desired fix. Thanks.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.