Last Comment Bug 539426 - Print to file by default PostScript, other Gnome apps default to PDF
: Print to file by default PostScript, other Gnome apps default to PDF
Product: Core
Classification: Components
Component: Printing: Setup (show other bugs)
: unspecified
: All Linux
-- minor with 1 vote (vote)
: mozilla9
Assigned To: Timothy Arceri
: Jet Villegas (:jet)
Depends on:
  Show dependency treegraph
Reported: 2010-01-13 06:14 PST by Otto Kekäläinen
Modified: 2011-12-21 13:42 PST (History)
5 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

Patch to print to pdf by default (684 bytes, patch)
2011-09-18 01:05 PDT, Timothy Arceri
roc: review+
Details | Diff | Splinter Review

Description User image Otto Kekäläinen 2010-01-13 06:14:58 PST
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; fi; rv: Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729)
Build Identifier: Gecko/20100106 Ubuntu/9.10 Firefox/3.5.7

The Mozilla/Firefox print dialog does not seem to work like the print
dialog in other Gnome applications:

1. In Firefox, the default file type is PostScript, while in Gedit it is PDF. (this bug report)
2. In Firefox the default file name is empty ".ps", while in Gedit it is
"print.pdf". (bug #485067)
3. In Firefox, the print dialog does not remember any settings unlike the
dialog in Gedit. If you for example choose in the Firefox dialog to make a
two-sided print, nothing of it is left when you restart Firefox. In Gedit every
change to any optio is saved - if you once choose to e.g. make a two-sided
print, all prints will be two-sided until the option is changed again.
4. The file dialog does not remember the folder last used (bug #454003)

In my opinion Firefox should implement the print dialog in the same way as
other Gnome/GTK apps do. The behaviour of e.g. Gedit is more correct and closer
to the principles for example described in the Gnome User Interface Guidelines.

Also I read the original Netscape's philosophy was "keep each dialog in the same state where it was last time".

Please make PDF the default file type or allow the dialog to remember the file type selected earlier.

I think PDF is a good default since it is a more common format than PostScript (I know that PDF includes PS, but from the regular users point of view they are not the same).

Reproducible: Always

Steps to Reproduce:
1. On newest Ubuntu, open a page with Firefox
2. Choose File > Print
3. Choose Print to File
Actual Results:  
Post Script is selected by default. For most users, it is really annoying. Since there is no way currently for the user to save a better default, they need to manually change the file type each time..

Expected Results:  
PDF would be a more sensible and user friendly default.

The bug 485067 is closely related, but not duplicate.
Comment 1 User image Wayne Mery (:wsmwk, NI for questions) 2011-05-25 10:20:22 PDT
reporter, does this still fail when using Firefox 5 *beta* or Firefox 4?
Comment 2 User image Otto Kekäläinen 2011-05-25 10:33:55 PDT
Yes, this is still present. I have a fresh install of Ubuntu 11.04 with Firefox 4.

Amazing that I'm the only one bothered by this. Does not anybody else print web pages as PDF files..?
Comment 4 User image Otto Kekäläinen 2011-05-25 11:04:04 PDT
Actually, now when I read up on this I can remember the history. While using Ubuntu 9.10 and Firefox 3.x the printing dialog was fine, but then in Ubuntu 10.04 and Firefox 3.6 it got broken.

I originally found a bug report about it and commented it at

As I was asked to file new bug reports for the related notices I made, I filed this bug report and

Personally I though think they are all related to the same Firefox or GTK regression introduced in Ubuntu 10.04.
Comment 5 User image Otto Kekäläinen 2011-05-25 11:05:07 PDT
Oh and I almost forgot: yes, I looked through the list and did not find any new issues related to his. Bug 485067 is the main one and it seems to have several duplicates filed.
Comment 6 User image Timothy Arceri 2011-09-18 01:05:54 PDT
Created attachment 560765 [details] [diff] [review]
Patch to print to pdf by default

I've attached a patch that will make print to pdf default.
Comment 7 User image Timothy Arceri 2011-09-20 06:56:49 PDT
Also note this patch will resolve the bug as a side affect
Comment 8 User image Robert O'Callahan (:roc) (email my personal email if necessary) 2011-09-20 12:33:21 PDT
Comment on attachment 560765 [details] [diff] [review]
Patch to print to pdf by default

Review of attachment 560765 [details] [diff] [review]:

How does this change the default format to PDF? Don't you need to change nsDeviceContextSpecGTK::GetPrintMethod as well?
Comment 9 User image Timothy Arceri 2011-09-20 15:58:28 PDT
Hi Robert,
          Thanks for taking a look at the patch so quickly. To answer your question, no nothing else needs to be changed.

The code that sets pdf to default is in nsPrintSettingsGTK.cpp this checks the extension of the string that I have changed: 

  if (StringEndsWith(nsDependentString(aToFileName), NS_LITERAL_STRING(".ps"))) {
    gtk_print_settings_set(mPrintSettings, GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT, "ps");
  } else {
    gtk_print_settings_set(mPrintSettings, GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT, "pdf");

Maybe it could be improved so that the string is set to mozilla. rather than mozilla.pdf then the extension is attached in nsPrintSettingsGTK.cpp after the print setting is set.

Note: The whole setting of the extension in the application seems a bit messy and I've suggested an improvement to GTK here
Comment 10 User image Robert O'Callahan (:roc) (email my personal email if necessary) 2011-09-20 16:24:40 PDT
Comment on attachment 560765 [details] [diff] [review]
Patch to print to pdf by default

Review of attachment 560765 [details] [diff] [review]:

I see, thanks.
Comment 12 User image Ed Morley [:emorley] 2011-09-23 20:53:46 PDT
Comment 13 User image David Dahl :ddahl 2011-12-20 14:39:13 PST
This is not fixed. I have never seen Firefox default to PDF in the print dialog:

Is there an automated test for this?
Comment 14 User image Timothy Arceri 2011-12-20 17:54:05 PST
This is fixed. Your problem is with stale preferences as reported here:
Comment 15 User image Otto Kekäläinen 2011-12-21 13:42:43 PST
I am the original reporter. I just installed a fresh Ubuntu 12.04 alpha with Firefox 8, and there the default filename is Mozilla.pdf, so I consider this bug fixed.

(Although I remember that in some early Firefox, the default file name was the tag <title>.pdf, which would be cool, but that is another feature request.)

Note You need to log in before you can comment on or make changes to this bug.