Bug 22026

Summary: patch to fix ps generation from pdftops with -level1sep
Product: poppler Reporter: William Bader <williambader>
Component: splash backendAssignee: 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: suggested patch to poppler-0.10.7/poppler/SplashOutputDev.cc
example of bad output from -level1sep
rendering with -level1sep fixed but without the luminosity color[4] fix

Description William Bader 2009-06-01 14:40:47 UTC
-level1sep requires building with -DSPLASH_CMYK.  If you do the build, SplashOutputDev::setSoftMask in SplashOutputDev.cc calculates luminance in the case for splashModeCMYK8 using color[4] instead of color[3] for the black component. The attached file shows this problem.
Comment 1 William Bader 2009-06-01 14:42:14 UTC
Created attachment 26344 [details] [review]
suggested patch to poppler-0.10.7/poppler/SplashOutputDev.cc
Comment 2 William Bader 2009-06-01 14:48:23 UTC
My sample file is 3 MB and too large to post.  Contact me at williambader@hotmail.com for a copy by email.
Comment 3 Albert Astals Cid 2009-06-03 12:27:55 UTC
the color[4] -> color[3] thing is already fixed in master.

For the other issue i think i like better this

diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index d24e77e..323d08e 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -2951,6 +2951,10 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
     paperColor[0] = paperColor[1] = paperColor[2] = paperColor[3] = 0;
     splashOut = new SplashOutputDev(splashModeCMYK8, 1, gFalse,
                                    paperColor, gTrue, gFalse);
+#else
+  } else if (level == psLevel1Sep) {
+    error(-1, "pdftops was built without CMYK support, -level1sep needs it to work in this file");
+    return gFalse;
 #endif
   } else {
     paperColor[0] = paperColor[1] = paperColor[2] = 0xff;

What do you think?
Comment 4 William Bader 2009-06-03 13:21:49 UTC
Created attachment 26405 [details]
example of bad output from -level1sep
Comment 5 William Bader 2009-06-03 13:22:49 UTC
Created attachment 26406 [details]
rendering with -level1sep  fixed but without the luminosity color[4] fix
Comment 6 William Bader 2009-06-03 13:30:27 UTC
Yes, your patch is better than mine because it reports an error only when PSOutputDev::checkPageSlice() is called and poppler has been compiled without SPLASH_CMYK.  pdftops will process many files correctly, even without SPLASH_CMYK, as long as it does not call checkPageSlice().
I have attached a rendering with and without SPLASH_CMYK to show what happens in case anyone else runs into this.
Comment 7 Albert Astals Cid 2009-06-03 13:38:43 UTC
Patch commited, will be in next poppler version

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.