Bug 330820

Summary: Scaling to fit print margins incorrectly scales cropped page
Product: [Applications] okular Reporter: Stephen Mollett <molletts>
Component: printingAssignee: Okular developers <okular-devel>
Status: CONFIRMED ---    
Severity: normal CC: aacid, aspotashev, auxsvr, casta, gianluca.pettinello, luigi.toscano, m.weghorn, mark.vanrossum, matthewtrescott, nate, tuomas, vascom2
Priority: NOR Keywords: usability
Version: 0.18.1   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
URL: http://www.nerdybloke.net/RulerPage.pdf
Latest Commit: Version Fixed In:

Description Stephen Mollett 2014-02-05 20:35:32 UTC
When printing a page which has content close to the edges of the paper (the URL is a test page which allows the exact print area to be measured), the page is scaled down into the printer margins but the image is still cropped.

Setting the printer margins to 0 results in the image being cropped, as expected. Leaving them at the values returned by the driver (for my HP Color LaserJet 4600, top/bottom=12.70mm, left/right=6.35mm) causes the already-cropped page to be scaled down. In other words, the same parts of the image are missing as on the "raw" page, but there is more white space around the image, as if the scaling was applied after the cropping.

Reproducible: Always

Steps to Reproduce:
1. Open a document with content close to the edges of the page.
2. Print it to a printer which does not support full-bled printing
Actual Results:  
Page is printed scaled down but with content still missing from the edges of the image.

Expected Results:  
Page should be printed with all content present and scaled to the configured print area of the printer.

Running Gentoo/amd64 with cups 1.7.1. Have observed the bug when printing to several other printers at home and at work - a LaserJet 4, a Ricoh GelSprinter, a LaserJet P3015 and a Color LaserJet 2700.
Comment 1 Albert Astals Cid 2014-02-05 20:48:58 UTC
Which distro are you using?
Comment 2 Stephen Mollett 2014-02-06 10:28:55 UTC
(In reply to comment #1)
> Which distro are you using?

Gentoo/amd64 (with ~amd64 keyword)
Comment 3 Albert Astals Cid 2014-02-07 00:02:20 UTC
Ok, i fixed this a month ago but it seems to me something has regressed in cups, i'll have a look when/if I have time but if you have time and know how to do it, it would be great if you could install older/newer versions of cups and see when/if starts working.
Comment 4 Stephen Mollett 2014-02-08 14:47:06 UTC
(In reply to comment #3)
> ... it would be great if you could install older/newer versions of
> cups and see when/if starts working.

Initial progress report: so far, I've tested 1.7.1 (which I was using to begin with) and 1.6.4 which are the only versions that are in Portage and it appears to affect both.

I'll look at some older versions now, either by hacking ebuilds so they're managed or installing/removing manually.
Comment 5 Stephen Mollett 2014-02-08 14:59:03 UTC
Hm, interesting. It just occurred to me that the 12.7/6.35mm margins sounded a bit big so I installed evince and printed the ruler page from that with page scaling set to "none" and the printer I'm testing on (LaserJet 1100) appears to have margins of 4mm all round.

Maybe there's an additional issue with the way margins are handled. Should I open a separate bug for this?
Comment 6 Albert Astals Cid 2014-02-08 23:23:57 UTC
It's a different bug, so yes, sure, please do.
Comment 7 Stephen Mollett 2014-02-22 17:23:18 UTC
(In reply to comment #6)
> It's a different bug, so yes, sure, please do.

False alarm - it's the PPDs which are being far too conservative. They specify 18/36-point margins for most of the printers I have access to.

(In reply to comment #3)
> Ok, i fixed this a month ago but it seems to me something has regressed in
> cups, i'll have a look when/if I have time but if you have time and know how
> to do it, it would be great if you could install older/newer versions of
> cups and see when/if starts working.

cups-1.5.4 seems to work as intended and actually scales the image to fit the 4mm hard margins of the printer rather than the 12.7/6.3mm margins reported by the PPD.

I'm beginning to think that maybe this is really a cups bug that has simply been exposed by something Okular does.
Comment 8 Albert Astals Cid 2014-02-23 16:42:46 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > It's a different bug, so yes, sure, please do.
> 
> False alarm - it's the PPDs which are being far too conservative. They
> specify 18/36-point margins for most of the printers I have access to.

Good, one bug less to worry about :-)

> (In reply to comment #3)
> > Ok, i fixed this a month ago but it seems to me something has regressed in
> > cups, i'll have a look when/if I have time but if you have time and know how
> > to do it, it would be great if you could install older/newer versions of
> > cups and see when/if starts working.
> 
> cups-1.5.4 seems to work as intended and actually scales the image to fit
> the 4mm hard margins of the printer rather than the 12.7/6.3mm margins
> reported by the PPD.
> 
> I'm beginning to think that maybe this is really a cups bug that has simply
> been exposed by something Okular does.

If you have time it would be awesome if you can try between the different cups version of 1.5.4 (that you say works) and 1.7.1 (that you say it does not) so we can pin point a bit more where it broke and then maybe approach the cups developers about it.
Comment 9 Tuomas Suutari 2014-12-05 14:13:54 UTC
(In reply to Stephen Mollett from comment #7)
> I'm beginning to think that maybe this is really a cups bug that has simply
> been exposed by something Okular does.

Did you report this to CUPS bug tracker?

I have the same problem in Kubuntu 14.04 with CUPS 1.7.2-0ubuntu1.2 and Okular 4.13.3-0ubuntu0.1 and would like to track progress of this...
Comment 10 Mark van Rossum 2015-02-27 15:23:55 UTC
Also in cups 1.7.5 on FC21.

As already asked, has this been reported to CUPS?
Comment 11 Nate Graham 2017-09-29 00:59:39 UTC
Marking this as a duplicate of https://bugs.kde.org/show_bug.cgi?id=348172, since once that's fixed, this will work, too.

(Albert, feel free to harrangue me if I'm wrong about this :) )

*** This bug has been marked as a duplicate of bug 348172 ***
Comment 12 Albert Astals Cid 2017-09-29 21:36:02 UTC
The duplication you did is wrong.

This bug is that the pages are getting cropped when they should not, nothing to do with adding extra scaling options.
Comment 13 Vasiliy Glazov 2019-01-17 08:21:27 UTC
Bug still present.
Comment 14 Gianluca Pettinello 2019-02-17 07:16:21 UTC
Confirmed and other softwares are ok. Possible to copy their code for printing?
Comment 15 Nate Graham 2019-06-14 17:02:54 UTC
*** Bug 408273 has been marked as a duplicate of this bug. ***