After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 679883 - When printing Custom paper sizes GTK Print Dialog does not send correct page size attribute
When printing Custom paper sizes GTK Print Dialog does not send correct page ...
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Printing
3.4.x
Other Linux
: Normal critical
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2012-07-13 17:58 UTC by Till Kamppeter
Modified: 2012-12-16 18:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Check whether "Custom." prefix is already present in the name of selected paper size. (1.07 KB, patch)
2012-09-18 12:29 UTC, Marek Kašík
committed Details | Review

Description Till Kamppeter 2012-07-13 17:58:56 UTC
Original bug report to Ubuntu:

https://bugs.launchpad.net/ubuntu/+source/gimp/+bug/998156

To print a job on a custom paper size one has to send it with the attribute

PageSize=Custom.WIDTHxHEIGHT[UNIT]

for example

PageSize=Custom.8x10in

with the unit being optional. The unit can be in, pt, cm, or mm.

The GTK print dialog sends

PageSize=Custom.Custom.WIDTHxHEIGHT[UNIT]

instead (2 times "Custom.").

This breaks printing with CUPS. Many drivers do not recognize a valid page size at all and try to print with width = 0 and height = 0. In any case no printout with the given custom size comes out.

Some applications, like Firefox, make the GTK print dialog send this wrong attribute even with regular page sizes.

To reproduce:

Run the command

cupsctl LogLevel=debug

In an application choose File/Print in the menu, in the print dialog select a printer on the "General" tab, switch to "Page Setup" tab, click on paper size drop down and choose "Manage Custom Sizes ...". Create a custom paper size. Now choose the newly created custom size and print.

In /var/log/cups/error_log You will find a line like

D [13/Jul/2012:19:24:49 +0200] [Job 626] argv[5]="InputSlot=Default PageSize=Custom.Custom.595.28x841.89 Duplex=None PrintoutMode=Normal PrinterResolution=FromPrintoutMode number-up=1 job-uuid=urn:uuid:bd2f3351-a345-3abb-63d9-ea13d11a8f39 job-originating-host-name=localhost time-at-creation=1342200218 time-at-processing=1342200289"

Note the "PageSize=Custom.Custom.595.28x841.89" in the line.

I have tested it with Thunderbird but users report it for nearly every other application with GTK print dialog.
Comment 1 Till Kamppeter 2012-07-13 21:47:17 UTC
Comments #74 and #75 in the Ubuntu bug report

https://bugs.launchpad.net/ubuntu/+source/cups/+bug/973270

show a similar problem: When printing from Inkscape or evince the jobs get sent with an "PageSize=Custom.BrA3_S" attribute. Perhaps it is caused by the same bug but with a regular page size chosen.
Comment 2 Marek Kašík 2012-09-18 12:29:27 UTC
Created attachment 224615 [details] [review]
Check whether "Custom." prefix is already present in the name of selected paper size.

This patch fixes the first problem by checking whether the prefix is already there.
Comment 3 Marek Kašík 2012-09-18 14:29:05 UTC
For the second problem:

The problem with Inkscape is that it doesn't let you select paper size so it always (my guess) print to a custom paper size whose dimensions are taken from "Document properties". This triggers the reported problem and should be solved by the patch.

Evince remembers last used paper size and tries to use it again when printing. It can happen that you print the document on A3 paper on a printer but after that you want to print it on another printer which does not support A3 (e.g. the HP CP1515n). In that case the A3 paper size is custom for the second printer. It is a little different problem then the originally reported.
You can see similar behaviour if you change PPD of the printer from a one which supports printing on A3 to a PPD which doesn't support it.

Regards

Marek
Comment 4 Colin Walters 2012-09-19 15:12:32 UTC
Review of attachment 224615 [details] [review]:

This looks safe and sane to me.
Comment 5 Marek Kašík 2012-09-19 16:33:44 UTC
Hi,

I've committed the patch to the master and to the gtk-3-4 branch. I'm closing this.

Regards

Marek
Comment 6 su-v 2012-09-19 18:04:26 UTC
Could the fix be backported to GTK+ 2.24? Current Inkscape still use GTK2, as does GIMP 2.8.
Comment 7 Till Kamppeter 2012-12-13 23:58:04 UTC
Also Firefox and Thunderbird are still using GTK 2.x.
Comment 8 Michael Natterer 2012-12-16 18:20:22 UTC
Done:

commit d9f9925878773fb37d1a385a929ddcbb4ef8fb80
Author: Marek Kasik <mkasik@redhat.com>
Date:   Tue Sep 18 14:18:15 2012 +0200

    printing: Add "Custom." prefix only once to paper size
    
    Check whether "Custom." prefix is already present in the name
    of selected paper size. (#679883)
    (cherry picked from commit be7752183eb07274b67036362f895b31aa28eb25)

 modules/printbackends/cups/gtkprintbackendcups.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)