[cups.general] Problems printing PDF files through cups.

Gerald Britton gerald.britton at gmail.com
Sat Sep 29 05:27:04 PDT 2007


I don't know if this helps, but:

Today, I tried the same document at home on my PhotoSmart printer
(c4180).  The fitplot option almost works.  It scales correctly but
prints the file portrait so it gets cut off.  Adding -o landscape got
the orientation right, but cut off the left hand part of the document.
 The actual size printed is  8 1/2 in long, not 11 in as it should be.
  So it scaled it for landscape printing, printed it landscape, but
sized the output for portrait!

Weird.



On 9/28/07, Gerald Britton <gerald.britton at gmail.com> wrote:
> OK  -- so here's what I did:
>
> sed 's/\/DeferredMediaSelection true
> \/PageSize/\/DeferredMediaSelection false \/PageSize/'
> /etc/cups/ppd/ps0198.ppd |> /etc/cups/ppd/ps0198new.ppd
>
> (I've attached the modified ppd)
>
> $export PPD=/etc/cups/ppd/ps0198new.ppd
> $echo $PPD
> /etc/cups/ppd/ps0198new.ppd
>
> /usr/lib/cups/filter/pdftops "1" "dummy" "dummy" "1" "fitplot=true
> PageSize=Letter" my.pdf > /tmp/pdftops.out
>
> /usr/lib/cups/filter/pstops  "1" "gerald" "pdftest" "1" "fitplot=true
> PageSize=Letter" /tmp/pdftops.out >/tmp/pstops.out
>
> DEBUG: slow_collate=0, slow_duplex=0, slow_order=0
> DEBUG: Before copy_comments - %!PS-Adobe-3.0
> DEBUG: %!PS-Adobe-3.0
> DEBUG: %%Creator: xpdf/pdftops 3.00
> DEBUG: %%LanguageLevel: 2
> DEBUG: %%DocumentSuppliedResources: (atend)
> DEBUG: %%DocumentMedia: plain 2066 717 0 () ()
> DEBUG: %%BoundingBox: 0 0 2066 717
> DEBUG: %%Pages: 1
> DEBUG: %%EndComments
> DEBUG: Before copy_prolog - %%BeginDefaults
> DEBUG: Before copy_setup - %%BeginSetup
> DEBUG: Before page loop - %%Page: 1 1
> DEBUG: Copying page 1...
> PAGE: 1 1
> DEBUG: pagew = 576.0, pagel = 720.0
> DEBUG: bboxw = 2066, bboxl = 717
> DEBUG: PageLeft = 18.0, PageRight = 594.0
> DEBUG: PageTop = 756.0, PageBottom = 36.0
> DEBUG: PageWidth = 612.0, PageLength = 792.0
> DEBUG: Wrote 1 pages...
>
> NOTE: the pagew, etc. are different from the last run, which was:
>
> DEBUG: pagew = 587.9, pagel = 767.9
> DEBUG: bboxw = 2066, bboxl = 717
> DEBUG: PageLeft = 12.0, PageRight = 599.9
> DEBUG: PageTop = 780.0, PageBottom = 12.1
> DEBUG: PageWidth = 612.0, PageLength = 792.0
>
> then I ran:
>
> lp -d ps0198 -o raw /tmp/pdftops.out
>
> lp -d ps0198 -o raw /tmp/pstops.out
>
> The first file prints correctly.  The second one is now scaled tiny
> (about 10%) but printed without prompting.
>
> On 9/28/07, Helge Blischke <h.blischke at srz.de> wrote:
> > Gerald Britton wrote:
> > > OK -- check this out.  Here's what I did and what I got on the
> > > console.
> > >
> > > jerryb1 at ubuntu:~$ echo $PPD
> > > /etc/cups/ppd/ps0198.ppd
> > > jerryb1 at ubuntu:~$ erho $CUPS_SERVERROOT
> > > -bash: erho: command not found
> > > jerryb1 at ubuntu:~$
> > > jerryb1 at ubuntu:~$
> > > jerryb1 at ubuntu:~$ echo $PPD
> > > /etc/cups/ppd/ps0198.ppd
> > > jerryb1 at ubuntu:~$ echo $CUPS_SERVERROOT
> > > /etc/cups
> > > jerryb1 at ubuntu:~$ /usr/lib/cups/filter/pdftops "1" "dummy" "dummy" "1"
> > > "fitplot=true PageSize=Letter"
> > > /home/shared/gramps/media/CanadaCensus1851/CAN1851Census-Hamilton-ON-Pg303a.pdf
> > >
> > >>/tmp/pdftops.out
> > >
> > > ERROR: pdftops-options: -cfg /etc/cups/pdftops.conf
> > > jerryb1 at ubuntu:~$ /usr/lib/cups/filter/pstops  "1" "gerald" "pdftest"
> > > "1" "fitplot=true PageSize=Letter" /tmp/pdftops.out >/tmp/pstops.out
> > > DEBUG: Page = 612x792; 12,12 to 600,780
> > > DEBUG: slow_collate=0, slow_duplex=0, slow_order=0
> > > DEBUG: Before copy_comments - %!PS-Adobe-3.0
> > > DEBUG: %!PS-Adobe-3.0
> > > DEBUG: %%Creator: xpdf/pdftops 3.00
> > > DEBUG: %%LanguageLevel: 2
> > > DEBUG: %%DocumentSuppliedResources: (atend)
> > > DEBUG: %%DocumentMedia: plain 2066 717 0 () ()
> > > DEBUG: %%BoundingBox: 0 0 2066 717
> > > DEBUG: %%Pages: 1
> > > DEBUG: %%EndComments
> > > DEBUG: Before copy_prolog - %%BeginDefaults
> > > DEBUG: Before copy_setup - %%BeginSetup
> > > DEBUG: Before page loop - %%Page: 1 1
> > > DEBUG: Copying page 1...
> > > PAGE: 1 1
> > > DEBUG: pagew = 587.9, pagel = 767.9
> > > DEBUG: bboxw = 2066, bboxl = 717
> > > DEBUG: PageLeft = 12.0, PageRight = 599.9
> > > DEBUG: PageTop = 780.0, PageBottom = 12.1
> > > DEBUG: PageWidth = 612.0, PageLength = 792.0
> > > DEBUG: Wrote 1 pages...
> > >
> > > After this I printed the resulting files using the command:
> > >
> > > lp -d ps0198 -o raw <file>
> > >
> > > The pdftops.out file printed correctly, the pstops.out file did not
> > > (letter, not legal, and not scaled to fit the paper)
> > >
> > >  I attached the pdftops, pstops and ppd files.
> > >
> > > printers.conf is:
> > >
> > > </Printer>
> > > <Printer ps0198>
> > > Info hp 9040 postscript
> > > Location corner
> > > DeviceURI socket://10.18.16.253
> > > State Idle
> > > StateTime 1190835823
> > > Accepting Yes
> > > Shared Yes
> > > JobSheets none none
> > > QuotaPeriod 0
> > > PageLimit 0
> > > KLimit 0
> > > OpPolicy default
> > > ErrorPolicy retry-job
> > > </Printer
> > >
> > > On 9/28/07, Helge Blischke <h.blischke at srz.de> wrote:
> > >
> > >>Gerald Britton wrote:
> > >>
> > >>>Amazing!  I did not know you could simply ftp a file to the printer.
> > >>>I just did the same thing with the same files I sent to you and they
> > >>>printed correctly!
> > >>>
> > >>>Now if I could just issue an lp command and achieve the same result....
> > >>>
> > >>>I ran the command:
> > >>>
> > >>>lp -d ps0198 /tmp/pstops.out
> > >>>
> > >>>and it printed INcorrectly (scaled 100% (not fitted), wrong paper type
> > >>>(not nearest size)).  Also I had to manually tell the printer to use
> > >>>letter stock!
> > >>>
> > >>>same thing with:
> > >>>
> > >>>lp -d ps0198 /tmp/pdftops.out
> > >>>
> > >>>Kurt suggested that my pdftops binary was broken by the debian team.
> > >>>I was quite prepared to believe that (not the first time) and was
> > >>>about to compile my own cups from the sources when your latest email
> > >>>arrived.
> > >>>
> > >>>So, tell me if I'm correct about things so far:
> > >>>
> > >>>1. If I use pdftops piped to pstops then ftp the file to the printer, it works
> > >>>2. The pdftops binary must be basically OK in my disto
> > >>>3. Same thing for my pstops filter
> > >>>4. Something strange happens when I let cups send the file to the
> > >>>printer from an lp command, whether from the original pdf or from the
> > >>>result of the pdftops or pstops commands
> > >>>
> > >>>At this point, where do you think the problem lies?  In the pdftops
> > >>>filter? In the pstops filter? Somewhere else?
> > >>>
> > >>>Anything else I can do to help get to the bottom of the problem?
> > >>>
> > >>>On 9/28/07, Helge Blischke <h.blischke at srz.de> wrote:
> > >>>
> > >>>
> > >>>>Kurt Pfeifle wrote:
> > >>>>
> > >>>>
> > >>>>>Gerald Britton wrote:
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>>>Thanks for working on this, Kurt.  I've learned a lot in the process
> > >>>>>>and that never hurts.  I'm disappointed that I can't reach my ultimate
> > >>>>>>goal, but I can do it easily with acrobat reader on windows (a couple
> > >>>>>>of clicks and it's rotated and scaled perfectly).  I just trying NOT
> > >>>>>>to use windows for stuff like this.
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>>Hey, I now notice you didn't even pay attention and respond to my
> > >>>>>comments about specifying "landscape" as an option.
> > >>>>>
> > >>>>>Or did you?
> > >>>>>
> > >>>>>And did you receive the files I mailed to you?!?
> > >>>>>
> > >>>>>And did you run the commandline exactly as I showed you, with the
> > >>>>>PPD  as an env variable? (and you verified the PPD has the full de-
> > >>>>>finitions for "Legal"? and the PPD passes the "cupstestppd" test?
> > >>>>>It may after all be the case that even your distro's wrapper script
> > >>>>>works correctly if used in the right way...)
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>>>On 9/27/07, Kurt Pfeifle <k1pfeifle at gmx.net> wrote:
> > >>>>>>
> > >>>>>>
> > >>>>>>
> > >>>>>>>Gerald Britton wrote:
> > >>>>>>>
> > >>>>>>>
> > >>>>>>>
> > >>>>>>>>here's the file I'm trying to print.
> > >>>>>>>
> > >>>>>>>I found it already in the meanwhile  :-)
> > >>>>>>>
> > >>>>>>>And I mailed you *my* results, which look perfect for "fitplot to
> > >>>>>>>Letter".
> > >>>>>>>
> > >>>>>>>
> > >>>>>>>
> > >>>>>>>
> > >>>>>>>
> > >>>>>>>>I want to print it landscape,
> > >>>>>>>
> > >>>>>>>No, you don't want to. Honest. :-)
> > >>>>>>>
> > >>>>>>>In 99.99% of cases, it will do the wrong thing when applied to PDF
> > >>>>>>>file printing. I don't believe your case is amongst the 0.01%  :-)
> > >>>>>>>
> > >>>>>>>
> > >>>>>>>
> > >>>>>>>
> > >>>>>>>
> > >>>>>>>>scaled down to fit my page size.  If you can do it for A4 or A3, I
> > >>>>>>>>should be able to do it for legal
> > >>>>>>>
> > >>>>>>>OK, I'll repeat the test for legal, and let you know the result.
> > >>>>>>>
> > >>>>>>>
> > >>>>>>>
> > >>>>>>>
> > >>>>>>>
> > >>>>>>>>http://data2.collectionscanada.ca/1851_pdf/e096/e002379200.pdf
> > >>>>>>>>
> > >>>>>>>>On 9/27/07, Gerald Britton <gerald.britton at gmail.com> wrote:
> > >>>>>>>>
> > >>>>>>>>
> > >>>>>>>>
> > >>>>>>>>>After some more experimenting, I used the following command:
> > >>>>>>>>>
> > >>>>>>>>>lp -o landscape -o media=legal -o fitplot -o PageSize=legal myfile.pdf
> > >>>>>>>>>
> > >>>>>>>>>the "-o=landscape" actually makes it print portrait!  So I removed that and ran:
> > >>>>>>>>>
> > >>>>>>>>>lp -o media=legal -o fitplot -o PageSize=legal myfile.pdf
> > >>>>>>>>>
> > >>>>>>>>>This got me closer to my goal.  The printout was landscape orientation
> > >>>>>>>>>(I know, doesn't make sense!) but the scaling was for portrait
> > >>>>>>>>>orientation and thus too small!
> > >>>>>>>>>
> > >>>>>>>>>On 9/27/07, Gerald Britton <gerald.britton at gmail.com> wrote:
> > >>>>>>>>>
> > >>>>>>>>>
> > >>>>>>>>>
> > >>>>>>>>>>Thanks Kurt!  Yes, the $ was just from my prompt, when I cut and
> > >>>>>>>>>>pasted my results.  Helge helped me with the other operands as well.
> > >>>>>>>>>>I ran the commands and sent the output directly (not to the list,
> > >>>>>>>>>>since it is too big).
> > >>>>>>>>>>
> > >>>>>>>>>>I tried gv as you suggested.  It shrank the pdf to fit the page but
> > >>>>>>>>>>didn't obey the printer directive to fit to the nearest size and
> > >>>>>>>>>>scale.
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>Finally, it seems to an issue of the printer (i.e. the printer's PS interpreter)
> > >>>>itself. If I feed the PS files I got from Gerald (both the pdftops output as well
> > >>>>as the pstops output) to one of our HP printers, without further manipulation
> > >>>>(I used plain old ftp to submit the data), all printers I tested shrinked the
> > >>>>huge page to the largest available media, properly scaled and rotated.
> > >>>>
> > >>>>Gerald, perhaps you could once more feed the pdftops output through
> > >>>>the pstops filter with the PPD configured, as Kurt proposed (sorry, I forgot
> > >>>>to mention it), just to be sure.
> > >>>>
> > >>>>Helge
> > >>>>
> > >>>>PS: When I need to modify the "alternate pstops filter" next time, I'll
> > >>>>implement the fitplot option for PS printers that do *not* correctly
> > >>>>follow the PS specification regarding the page size policies.
> > >>>>
> > >>>>--
> > >>>>Helge Blischke
> > >>>>Softwareentwicklung
> > >>>>
> > >>>>H.Blischke at acm.org
> > >>>>_______________________________________________
> > >>>>cups mailing list
> > >>>>cups at easysw.com
> > >>>>http://lists.easysw.com/mailman/listinfo/cups
> > >>>>
> > >>>
> > >>>
> > >>Please repeat the offline pstops step after setting the PPD
> > >>environment variable to the abolute path to your printer's PPD
> > >>and post the result. I'd definitely like to look into that
> > >>before speculating any more.
> > >>And BTW, which backend do you use for your printer?
> > >>(post the device_uri).
> > >>
> > >>Helge
> > >>
> > >>
> > >>--
> > >>Helge Blischke
> > >>Softwareentwicklung
> > >>
> > >>H.Blischke at acm.org
> > >>_______________________________________________
> > >>cups mailing list
> > >>cups at easysw.com
> > >>http://lists.easysw.com/mailman/listinfo/cups
> > >>
> >
> > Well, found the culprit! The PPD is bogus:
> >    All the PageSize (or page region or imageable area) statements set
> >    /DeferredMediaSelection true
> >    in the setpagedevice dictionary. This cancels the PS interprter's
> >    internal firplot feature which requires
> >    /DeferredMediaSelection false .
> > This, BTW, causes the printer to complain about the page size.
> >
> > If you edit the PPD and delete all the "/DeferredMediaSelection true"
> > from *all* PageSize and PageRegion statements, it should work OK.
> >
> > Helge
> >
> >
> > --
> > Helge Blischke
> > Softwareentwicklung
> >
> > H.Blischke at acm.org
> >
> >
> >
>





More information about the cups mailing list