Bug 32365

Summary: Missing text with pdftops -level1sep
Product: poppler Reporter: William Bader <williambader>
Component: generalAssignee: poppler-bugs <poppler-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: williambader
Version: unspecified   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: patch to fix this PDF
revised patch that fixes this PDF for both -level1 and -level1sep
revised patch for that runs faster
revised patch that runs faster for -level1sep
pdf that breaks with -level1
Revised patch that fixes the problem with -level1

Description William Bader 2010-12-13 16:10:16 UTC
With "pdftops -level1sep", the gray logo at the upper right is missing, or more precisely, it appears but is then overwritten by white.
I used pdftops from popper-0.15.2, but it also happens with pdftops from xpdf-3.02pl4, so it is an old problem.
I am using 32-bit version of Fedora 14 Linux.
This is a different issue than the image issue that I reported a few weeks ago.  A version of pdftops with my HasColorPattern patch does not show the HasColorPattern comment on this file.
Comment 1 William Bader 2010-12-13 16:15:38 UTC
The PDF is 2.5 MB so bugzilla would not accept it.
I have temporarily posted it to
http://williambader.com/elp-S37263-14dec10.pdf
Comment 2 William Bader 2010-12-14 18:18:22 UTC
Created attachment 41131 [details] [review]
patch to fix this PDF

This patch adds code to PSOutputDev::doImageL1Sep() to call maskToClippingPath() when it is passed an explicit mask.  With this patch, pdftops -level1sep generates the correct image for the attached PDF.
Comment 3 William Bader 2010-12-14 19:52:54 UTC
Created attachment 41134 [details] [review]
revised patch that fixes this PDF for both -level1 and -level1sep

This patch is similar to the first one, but includes similar changes to doImageL1().
Comment 4 William Bader 2010-12-15 09:47:18 UTC
Created attachment 41146 [details] [review]
revised patch for that runs faster

This patch should produce the same results as the previous patch, but when generating level1sep output from the attached pdf, this patch reduces the pdftops runtime from 12.7 sec to 1.9 sec (on a 2.2GHz Core2Duo running Fedora 14).
The patch has two main differences from the previous one.
When writing the image data in doImageL1Sep(), if processColors already has every process color set, it uses an alternate loop that does not call addProcessColor() on each pixel.
Also, when writing the image data, instead of calling writePSFmt("{0:02x}") for each pixel, it saves a line at a time in a buffer and writes the buffer with a new writePSBuf() function that takes a string and a length.
The patch has less effect on other output options and on other files.
Comment 5 William Bader 2010-12-15 12:33:43 UTC
Created attachment 41153 [details] [review]
revised patch that runs faster for -level1sep

This patch is similar to the previous patch except that it also skips the process color check in checkPageSlice() if all of the color flags have already been set.  This makes -level1sep output faster for some files.
Comment 6 Albert Astals Cid 2011-01-11 14:36:51 UTC
I've finished running the regtest with -level1sep and it all looks nice and improves a few pdf files

I´ll be running also regtest with other the levels but that should not present any problem since i understand it should not affect at all if it is not level1sep
Comment 7 Albert Astals Cid 2011-01-11 14:51:03 UTC
Unfortunately your patch breaks conversion to ps of the first page of a pdf i will be attaching when running with -level1

Please have a look and fix.
Comment 8 Albert Astals Cid 2011-01-11 14:52:08 UTC
Created attachment 41896 [details]
pdf that breaks with -level1
Comment 9 William Bader 2011-01-11 16:13:54 UTC
Created attachment 41898 [details] [review]
Revised patch that fixes the problem with -level1

This should fix the problem.  One place that converted bytes to hex was wrong.
Comment 10 Albert Astals Cid 2011-01-21 00:47:55 UTC
Regtest has finished correctly, i'll give the patch a final review and commit it in a few hours :-)
Comment 11 Albert Astals Cid 2011-01-21 11:01:46 UTC
It's in, 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.