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 549039 - gtkprint doesn't use the ppd default paper size
gtkprint doesn't use the ppd default paper size
Status: RESOLVED FIXED
Product: eog
Classification: Core
Component: general
2.25.x
Other All
: Normal minor
: ---
Assigned To: EOG Maintainers
EOG Maintainers
Depends on: 564854
Blocks:
 
 
Reported: 2008-08-22 18:38 UTC by Andreas Moog
Modified: 2010-12-18 14:24 UTC
See Also:
GNOME target: ---
GNOME version: 2.23/2.24


Attachments
adds printer_name to GtkPageSetup (11.97 KB, patch)
2008-12-12 12:48 UTC, Marek Kašík
reviewed Details | Review
adds the signals CUSTOM_WIDGET_INIT and PRINTER_CHANGED (4.48 KB, patch)
2008-12-12 12:49 UTC, Marek Kašík
needs-work Details | Review
adds handling of the signals CUSTOM_WIDGET_INIT and PRINTER_CHANGED (3.26 KB, patch)
2008-12-12 12:49 UTC, Marek Kašík
reviewed Details | Review
the eog patch (4.81 KB, patch)
2008-12-17 13:11 UTC, Marek Kašík
none Details | Review
the gtk+ patch (6.27 KB, patch)
2008-12-17 13:16 UTC, Marek Kašík
none Details | Review

Description Andreas Moog 2008-08-22 18:38:14 UTC
This is forward of a bugreport on Launchpad:
(https://bugs.launchpad.net/gtk/+bug/258794)

When adding a printer using either the CUPS configuration interface or the system-config-printer tool, one can choose the default paper size of the printer, among several other options, depending on the driver.
An interesting consequence is that one can add multiple print queues with different configuration options, and especially different paper sizes, which can be very useful for multifunction printers (such as the Canon MPxxx series for example). These options are stored into the PPD files located in /etc/cups/ppd/.

For instance, a typical configuration, for a MFP, could be:
- one print queue for normal text printing (with A4 paper size, 600x600 dpi, colors),
- one print queue for draft text printing (A4 paper, 300x300 dpi DRAFT and grayscale),
- one print queue for photo printing (4x6 inches paper, 2400x2400 dpi, glossy photo paper, vivid colors).

The GTKPrint dialog allows the user to set several options, but not the paper size, which can be instead set on the "Page Setup" dialog, located into the "File" menu (for applications implementing GTKPrint).

The problem is that the paper size selected on the "Page Setup" dialog always overrides the default page size defined into the PPD file, and GTKPrint doesn't seem to use the paper size defined into the PPD file at all.
So, considering the default paper for the system is A4 (as for every European locales), whenever the user wants to print a photo using the associated print queue (#3 in the examples above), he has to set the paper size on the "Page Setup" dialog first.

This is counter-intuitive, since it requires the user additional steps to print a picture, while he already defined a default paper size when installing the printer.
A correct behavior would be for GTKPrint to use the default paper size set into the PPD files, while the "Page Setup" dialog would be used to *optionaly* override this setting.

The "Page Setup" dialog should also have an option to store the default settings per application ("Set as default").

Several applications are impacted by this behavior:
- evince, evolution, openoffice, eog, f-spot, etc.

Other information:
Comment 1 Marek Kašík 2008-09-24 14:28:00 UTC
Hi Andreas,
gtk+ gets default paper size from CUPS since version 2.13.1 (or 2.14.0 - stable version). Could you confirm that it works with the newer version?

  Thanks

    Marek
Comment 2 Julien Raeis 2008-10-02 22:07:49 UTC
I've just made a test with the Ubuntu Intrepid Ibex Beta version which uses libgtk 2.4.3. The tests have been made using several graphics apps such as EOG, the Gimp or F-Spot.

The paper size still isn't selectable from within the gtkprint dialog, and the photos I've printed on my 4x6 printer, despite having set a 4x6 paper size into cups for the printer, still print using the system-wide default paper size (A4 in my case, since my LC_PAPER variable is set to fr_FR@UTF-8).

So the bug seems to be still present :(
Comment 3 Marek Kašík 2008-11-28 13:41:47 UTC
Hi,
I had a look at it.
I can not reproduce the problem with F-spot (0.4.4) and Evince (2.24.1). Which versions do you have?

Openoffice doesn't use the default size, but it doesn't use it even with the KDE print dialog. So I guess that this is an Openoffice-specific problem in the case of Openoffice.

The problem shows up with Evolution. Evolution uses gtkhtml library but testing application, which is included in the gtkhtml library, prints well (it always uses the default paper-size).

Eog doesn't use the default paper-size also. I looked at this in a little more detail. The problem is that Eog creates custom-widget without knowledge of default paper-sizes. It has to select the paper-size according to the locale in such a case. There should be a way to get this information (actual GtkPrinter) during running of the GtkPrintDialog for the custom-widget. I'll go over this.

  Regards

    Marek
Comment 4 Julien Raeis 2008-12-04 23:22:03 UTC
Hi,

Ok, let me explain exactly what is happening (from an end user point of view).
I have two printers connected to my computer : one is an HP Laserjet 2300, printing A4 (I'm in Europe) documents in grayscale, the other one is an Epson Picture Mate photo printer, which can only print to 4"x6" photo paper (it doesn't accept any other input paper size).

I'm using gnome and either f-spot, eog, evince, Mozilla Firefox or OpenOffice.org to print documents and/or photos. My distribution is Ubuntu 8.04 or 8.10 but this problem seems independant from the Linux distribution in use and related to libgtk.

My locale is set to fr_FR.UTF-8, which defines the system-wide default print paper size to A4.

I've created two printers "queues" in CUPS : one for the HP printer, with A4 paper size, and another for the Epson photo printer with 4"x6" paper size.

Remember the system-wide default print paper size is A4.

If I do print a document from, let's say, OpenOffice.org or evince, which is in A4 format for instance, on my HP printer, everything goes fine: I do select "File"/"Print", then my printer on the GTKPrint dialog, and eventually click on the "Print" button. Good.

Now imagine I want to print a picture of my niece, taken with my camera. I can open it using eog, and follow the same procedure. The picture will be misprinted because GTKPrint will try to print using an A4 paper size on a 4x6 inches paper. As a result, I got either a distorted picture, or only a cropped one with, let's say, about a quarter of the head of my cute niece :/

As a solution, you may say I can go into the "Print setup" dialog found into the "File" menu, and select the right paper size, but I'll have to do this everytime I want to print a picture, since the settings are not remembered there from file to file. Even worse, remembering settings here doesn't solve the issue at all, since I may want to print the same things on different printers.
I mean, I can do the change everytime, even if it's counterintuitive, but my father forgets almost everytime to change the paper size, and wastes paper and ink :/

A good behaviour would be to have the paper size displayed into the GTKPrint dialog, and this setting to be really used. This way one won't have to select the paper size each time, but only change the default when needed, using the Print Setup dialog, or the option into the GTKPrint one.

F-spot implemented some kind or workaround by not using the Print Setup dialog, but adding its own widget for the paper size. Unfortunately it's unusable since it requires to be specified for each photo I want to print... same player shoots again :/

The gimpprint plugin seems to rely on the same gtkprint dialog.

Oh and another note: everything worked *very well* before gtkprint was used...

Here are the versions of the software I'm using:
eog            2.24.1
evince         2.24.1
openoffice.org 2.4.1
f-spot         0.50.3
libgtkhtml2    2.11.1
libgtk2.0      2.14.4
Comment 5 Marek Kašík 2008-12-12 12:47:36 UTC
Hi,
I looked at the trouble with Eog. There is the problem mentioned above (comment #3). But there is also one another problem. If you specify a paper size for a specific printer in GtkPageSetupUnixDialog then this paper size is used for all printers as default (printer's name is not mentioned in GtkPageSetup).
I wrote a patch which adds "gchar *printer_name" attribute to GtkPageSetup which stores name of the printer selected in GtkPageSetupUnixDialog. This information is then used for setting of paper size.
The default paper size of selected printer is used in another case.

The second problem is that the custom widget doesn't know the default paper size of the currently selected printer.
I added signal CUSTOM_WIDGET_INIT which is emitted after creation of GtkPrintUnixDialog. This signal gives pointer of the print dialog to the custom widget. I also added another signal PRINTER_CHANGED to which can the custom widget connect a callback. The custom widget can then actualize itself according to the selected printer.

Attached patches:
gtk_correct_page_setup.patch
  - adds printer_name to GtkPageSetup
gtk_printer_changed_signal.patch
  - adds the signals CUSTOM_WIDGET_INIT and PRINTER_CHANGED
eog_printer_changed_signal.patch
  - adds handling of the signal CUSTOM_WIDGET_INIT
  - handles changed paper size ("Image Settings" tab)
Comment 6 Marek Kašík 2008-12-12 12:48:33 UTC
Created attachment 124515 [details] [review]
adds printer_name to GtkPageSetup
Comment 7 Marek Kašík 2008-12-12 12:49:16 UTC
Created attachment 124516 [details] [review]
adds the signals CUSTOM_WIDGET_INIT and PRINTER_CHANGED
Comment 8 Marek Kašík 2008-12-12 12:49:56 UTC
Created attachment 124517 [details] [review]
adds handling of the signals CUSTOM_WIDGET_INIT and PRINTER_CHANGED
Comment 9 Matthias Clasen 2008-12-13 07:50:20 UTC
Ok, I think I understand the problem, and I see why it may be useful to store the printer name in the page setup. But I somehow fail to see how it really addresses the issue, since you still can only set one pagesetup on the printoperation, not one pagesetup per printer.

Wrt. to the patches, I don't really like how custom-widget-init brings the unix-specific print dialog into the printoperation api. How is this supposed to be implemented on win32 ? I'd prefer something slightly different, like

void (* update-custom-widget) (GtkPrintOperation *op,
                               GtkWidget         *widget,
                               GtkPrinter        *printer);

that would be emitted every time the selected printer changes. Would that work ?
You could still add the GtkPrintUnixDialog::printer-changed signal, and use that
in GtkPrintOperationUnix to implement ::update-custom-widget. 


+				      GtkWidget         *widget);
+  void     (*init_custom_widget)     (GtkPrintOperation *operation,
+                                      GtkWidget         *print_dialog,
+                                      GtkWidget         *custom_widget);
 
You can't compatibly add vfuncs like this in the middle of the class. It needs to be added after all existing vfuncs, before the padding, and you must reduce the padding by one to compensate.

Comment 10 Marek Kašík 2008-12-17 13:09:00 UTC
Hi,
I modified those patches.
Because the PageSetupDialog is supposed to give only one page setup, I excluded the GtkPageSetup patch.
I changed those other two patches.

I added signal "update-custom-widget", which brings page setup and print settings to custom widget (GtkPrinter and GtkPrintUnixDialog are unix-only), to Gtk+. Custom widget can actualize itself with these informations.

The second patch is updated Eog patch. There was problem, that Eog stores every change of GtkPageSetupUnixDialog to configuration file. The configuration from this file is then used for printing everytime until change.
I changed this behaviour: If GtkPageSetupUnixDialog is used, then the selected page setup is used for the actual session for all printers. If GtkPageSetupUnixDialog is not used, then the default page setup of selected printer is used.

Because this is an application specific bug, I'll reassign it to Eog. If you encounter similar behaviour with another application, file a bug against the application mentioning this bug.

I filed a new bug against Gtk+ with "update-custom-widget" signal feature request.

  Marek

P.S.:
Comment 11 Marek Kašík 2008-12-17 13:11:59 UTC
Created attachment 124860 [details] [review]
the eog patch
Comment 12 Marek Kašík 2008-12-17 13:16:21 UTC
Created attachment 124862 [details] [review]
the gtk+ patch

This is the same patch as the one attached to the bug #564854 (the Gtk+ bug) (attachement id=124861).

 Marek
Comment 13 Felix Riemann 2010-12-18 14:24:14 UTC
Merged the parts of your patch that we didn't have yet in into master.
Thanks for the patch and sorry for the long delay.

commit 796aae00058655d6f9e796f36fd7420991c657a7
Author: Marek Kašík <>
Date:   Sat Dec 18 15:19:14 2010 +0100

    Use default page settings when opening print dialog the first time
    
    Use the default page setup the first time after application start.
    Then re-use the last used page setup for rest of the time.
    Fixes bug 549039.

This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.