[poppler] poppler CUPS integration

Sascha Sommer ssommer at suse.de
Mon Oct 23 02:35:38 PDT 2006


On Monday 23 October 2006 06:42, Jeff Muizelaar wrote:
> On Sun, Oct 22, 2006 at 12:11:01PM +0200, Sascha Sommer wrote:
> > Hello,
> >
> > I went through the xpdf changes that were done in cups and tried to port
> > them to poppler.
> >
> > poppler-0.5.4_psheader_fix.patch seems to be necessary to get a valid
> > postscript header.
> It'd be nice to have more information on what this all changes and why
> it is needed.

If I understand the patch correctly it summarizes common headers for
psModePS, psModeEPS, psModeForm. In addition to that it adds Creator and Title 
information to the ps. Without this patch the ps (at least generated with the 
pdftops from cups) will not work with gs.

> > poppler-0.5.4_renderHiddenAnnotations.patch adds a new function to
> > OutputDev.h that can be overwritten to disable rendering of hidden
> > annotations. I did not find a pdf to test, therefore this hunk is
> > untested.
> A pdf to test would be nice.

I don't have one either. I only extracted the changes from cups pdftops.

> >    dict = str->streamGetDict();
> >
> > +  // get annotation flags and only print annotations that are hidden or
> > +  // don't have the print bit set.
> > +  dict->lookup("F", &flagsObj);
> This comment doesn't make much sense to me...

I updated it in the attached patch

> > poppler-0.5.4_renderPage.patch adds the function renderPage to OutputDev.
> > It will be called by Gfx.cc for every page to check if the selected page
> > should be printed. With this patch it is possible to render only a subset
> > of the available pages.
> This reminds me of the stuff the KDE people wanted. I am not a huge fan
> of this change because it further encourages the use of the raw poppler
> api which really doesn't have any sort of stability guarantees.
> It'd be better if CUPS used one of supported APIs. If adding extra
> depenecies on things like glib or qt is a problem I imagine it would be
> easy to add a straight forward c binding. My guess is that CUPS just
> uses poppler/xpdf for pdf to postscript conversion. So it wouldn't be
> tough to do.

The idea for this change was to have something like:

class cupsPSOutputDev: public PSOutputDev {
  cupsPSOutputDev(char *fileName, XRef *xrefA, Catalog *catalog,
      int firstPage, int lastPage, PSOutMode modeA,
      int paperWidthA = -1, int paperHeightA = -1,GBool duplexA = gTrue,
      int imgLLXA = 0, int imgLLYA = 0,int imgURXA = 0, int imgURYA = 0,
      GBool manualCtrlA = gFalse, my_additional_options_go_here)
        : PSOutputDev(fileName,xrefA,catalog,firstPage,lastPage,modeA,
            paperWidthA,paperHeightA,duplexA, imgLLXA, imgLLYA, imgURXA,           
            imgURYA, manualCtrlA){

  GBool renderHiddenAnnotations(){
    return gFalse;
  GBool renderPage(int page){
        check if the page should be rendered
        return (gFalse);

Cups needs something similar to the renderPage option to exclude certain pages 

> Michael, I notice you are on the CC. Do you have any thoughts about what
> kind of API you would like to see from poppler for use by CUPS?

I ccd him because http://cups.org/str.php?L1471+P0+S-2+C0+I0+E0+Qpoppler
is probably not the best place to discuss poppler changes.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: poppler-0.5.4_renderHiddenAnnotations.patch
Type: text/x-diff
Size: 1862 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/poppler/attachments/20061023/6e2f3e1e/poppler-0.5.4_renderHiddenAnnotations.bin

More information about the poppler mailing list