want default printer to be always Print to File
I am attempting to set up my default printing options by editing the about:config but firefox seems to ignore them when I call the print command
I am looking to have default behavior to just save the page to my disk as a pdf which I can do manually but for some reason but setting about:config to default to this behavior is not working
I altered the about:config file to the following I set print_printer to "Print to File" print.print_to_filename was set to "/home/username/filename" print.print_to_file was also set to true
I reset firefox after making the changes and when I attempt to print a web page it still selects my physical printer, the location and file name are ok once I select "Print to File" I just want it to actually use that as the default printing device not my office printer.
To make extra certain the settings were correct I reset the about:config values to default restarted firefox set print.save_print_settings to true restarted firefox printed a page selecting the values I wanted, printing the page to a pdf file. went back to about:config noted the values were what I wanted and set print.save_print_settings back to false, restarted firefox And it is still selecting my office printer.
If it matters the printer is an HP, would rather not uninstall it.
All Replies (11)
There is an add on that does this Print PDF
However is the HP the default printer on the computer? AFAIK it will always select the default first.
The issue is how do I set the default printing device in firefox to 'Print to File'? not how to print PDFs.
Does firefox use the field 'print_printer' inside about:config to select the default printer?
If it doesn't use about:config to select the default printer the question is why not? and how does firefox actually choose the default printer and how can I override this and set it to 'Print to File'?
I don't know why Print to file doesn't stick, but that is not a device like a printer. You have to select a printer when using Print to file, because Firefox needs to generate the codes, characters, and/or bits to output to a specific printer, regardless of whether you send it straight to the printer or divert it to a file.
Also, have you looked at any of those files -- are you sure the format is usable? Unless you select a PostScript printer, the file contents may consist of proprietary code that only makes sense to particular printers and can't be read by other software.
With a brand new Profile which hasn't been used for printing, about:config is open, and this pref doesn't appear in about:config. print.printer_printer_name._Printer.print_to_filename
Keeping in mind that about:config can't be printed, as soon as I use {Ctrl + P} this pref for my default printer appeared. print.printer_Brother_MFC-J615W_Printer.print_to_filename
Apparently that pref is set to the system default hardware printer the first time the user initiates the "print" command.
Basically that feature is a relic from the early days of personal computers. Not sure if it even belongs in today's software as it was primarily used thru DOS command line on the LPT# port, as I recall from the days of 286 / 386 PC's.
http://www.frogmorecs.com/arts/what-is-a-prn-file/ Print Distributor for Windows - http://www.frogmorecs.com/
Maybe you could find a Linux program that will work in like manner?
More information that I dug up. http://windows.microsoft.com/en-us/windows/print-to-file#1TC=windows-7 http://ask-leo.com/what_is_print_to_file_used_for.html
jscher2000- I am using linux, and 'Print to File' is a device, all a device does is talk to a file handle, the HP device talks to a file handle.
In the case of 'Print to File' it takes HTTP and does something to it and writes to the file handle either postscript (which is an actual language) or PDF. (which yes I can use hence why I want them in post script or pdf)
Inside linux/unix everything is a file meaning my printer (the actual physical device) is a file (note this is not what you are selecting in the print menu you are selecting the thing that will talk to the printers file handle), which means I could tell the 'Print to File' device to write to the printers file handle. No idea what it will do.
The HP_LaserJet device on the print menu just has more fluff so it can actually communicate with the printers file handle (ie read STDIN print to STDERR and print to STDOUT) odds are 'Print to File' just writes to STDOUT. I have no idea I am hoping someone with a deeper understanding might actually respond.
I just want FireFox to default to a very specific device so that when I make a web call using selenium (with the preference for quiet on) it will print using the "Print to File' device to disk instead of telling the hp device to tell the hp printer to start eating reams of paper, everything else works except for selecting the printing device how does firefox select this device. (and yes I know I can get png screenshots, but I actually need postscript or pdf)
Simple question, I want to set my default device for firefox, how does it do it and how can I over ride it.
And yes everything else I set in about:config works, it's just changing the default device.
I am just trying to avoid digging through the actual mailing lists and source code when the question is simple.
-Ed-Meister I don't think you understood anything I wrote, if you looked at the additional information I provided you will notice I am using a linux what you posted is related to windows.
Modified
Hi magpi, it did not occur to me that you had a virtual printer named "Print to file" and I assumed you were referring to the checkbox "Print to file" which I see in Windows. My bad, I should become more familiar with Linux.
What should happen is after you select a different printer and print is that Firefox should update your prefs.js file in your currently active profile folder with the printer name:
user_pref("print_printer", "Print to file");
and that also would appear in about:config under print_printer.
Note: The exact wording/spacing may vary, I'm not 100% sure how this works, obviously.
Is that part working in interactive use? In other words, does the setting appear in the prefs.js file? If you aren't accustomed to checking that file, you can open your current Firefox settings (AKA Firefox profile) folder using either
- "3-bar" menu button > "?" button > Troubleshooting Information
- (menu bar) Help > Troubleshooting Information
- type or paste about:support in the address bar and press Enter
In the first table on the page, click the "Open Directory" button.
If the setting does not appear in the file, it could be one of the problems in this article: How to fix preferences that won't save.
What the... you know, my prefs.js did NOT get updated with the second printer like I assumed it did, when I finally got around to testing this on my own Firefox. So you may need to edit prefs.js manually (with Firefox closed) and see whether that works. Apologies for not testing first.
Edit:
That was premature panic. It updated four minutes later. No idea why it took so long.
Modified
Thanks for shifting gears, but I still have the same problem I have already looked at my prefs.js on top of the config after doing a print job and it's set to "Print to File"
And again working with selenium it does have access to the prefs.js and I can alter the preferences and pass in new altered preference when calling a new webdriver. But I doubt that's the problem since ctrl-p still defaults to the HP device.
So why is firefox ignoring my prefs.js and my about:config options?
I am at a complete loss for why it would be behaving in such a counter intuitive manner, thankfully I have convinced my higher powers that their approach sucked and I no longer have to handle it "this way" but it has sort of become a sticking point for me, why is firefox ignoring my preference defaults for the printing device?
(also fun side note I keep saying the same about windows even though I have worked with it longer then linux/unix, windows is just a royal pain)
Modified
I don't know why your Firefox is not consistently reusing the last used printer. That's how it works on Windows... for what that's worth! Maybe there is something special about "Print to file" buried in the code somewhere. I can't stick around to search for it, and perhaps a Linux users will know the answer without that level of digging.
yeah sadly I think I am stuck with option "suck", signing up to the mailing list, pulling the source code and bookmarking the bugzilla page
https://bugzilla.mozilla.org/show_bug.cgi?id=326093 Yay not alone