X
Tap here to go to the mobile version of the site.

Support Forum

I can not adjust print margins in Firefox: even modifying them, they always remain the same. Why?

Posted

Why is it impossible to adjust print margins in Firefox? Even if you change the values, the printing margins are always the same. Why? With other browsers (Edge, Chrome), on the same websites, this does not happen and you can freely choose your favorite print margins, with Firefox not.

Why is it impossible to adjust print margins in Firefox? Even if you change the values, the printing margins are always the same. Why? With other browsers (Edge, Chrome), on the same websites, this does not happen and you can freely choose your favorite print margins, with Firefox not.

Chosen solution

Also, I filed a bug, but I don't know if anyone will have interest in working on it since printing often is last in line for fixing, especially when the causes of the problem are uncommon: https://bugzilla.mozilla.org/show_bug.cgi?id=1512893


Until then, the workaround: https://support.mozilla.org/questions/1243091#answer-1179748

Read this answer in context 0
Quote

Additional System Details

Application

  • User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:63.0) Gecko/20100101 Firefox/63.0

More Information

jscher2000
  • Top 10 Contributor
7925 solutions 64671 answers

Hi giuseppeg1973, what happens when you try to change the margins. They are ignored? Here's where I mean:

  • If you are in the Print Preview screen, click the Page Setup button.
  • If you are viewing the document, pull down the File menu (Alt+f if it's hidden) and click Page Setup.

By default, Firefox should show the "Format & Options" tab. Switch to the "Margins & Header/Footer" tab.

Depending on your regional settings, the values may refer to inches or millimeters. Do changes here "stick" for you?

Hi giuseppeg1973, what happens when you try to change the margins. They are ignored? Here's where I mean: * If you are in the Print Preview screen, click the Page Setup button. * If you are viewing the document, pull down the File menu (Alt+f if it's hidden) and click Page Setup. By default, Firefox should show the "Format & Options" tab. Switch to the "Margins & Header/Footer" tab. <center><img src="https://prod-cdn.sumo.mozilla.net/uploads/images/2018-12-08-12-24-54-bf8ca0.png" width="400"></center> Depending on your regional settings, the values may refer to inches or millimeters. Do changes here "stick" for you?
Was this helpful to you? 0
Quote
jscher2000
  • Top 10 Contributor
7925 solutions 64671 answers

Hi giuseppeg1973, if you meant the outer area where Firefox doesn't print at all -- the area above, below, and to the left and right of the header and footer -- there are hidden settings for that.

(1) In a new tab, type or paste about:config in the address bar and press Enter. Click the button accepting the risk.

(2) In the search box above the list, type or paste edge and pause while the list is filtered

(3) Double-click the print.printer_BrandX.print_edge_top preference and enter your desired distance in hundreds of an inch (assuming you use inch measurements). For example:

  • 10 => 1/10 inch
  • 25 => 1/4 inch

In a different tab, use print preview to test that there is now that amount of space between the top edge of the paper and the page title.

(4) Repeat for the print.printer_BrandX.print_edge_bottom, print.printer_BrandX.print_edge_left , and print.printer_BrandX.print_edge_right preferences.

If the edge preferences do not exist, or to hedge your bets, you can set the print.printer_BrandX.print_unwriteable_margin_bottom, print.printer_BrandX.print_unwriteable_margin_left , print.printer_BrandX.print_unwriteable_margin_right, and print.printer_BrandX.print_unwriteable_margin_top preferences similarly.

That should allow you to accommodate any printer's "unprintable" area. Success?

Hi giuseppeg1973, if you meant the outer area where Firefox doesn't print at all -- the area above, below, and to the left and right of the header and footer -- there are hidden settings for that. (1) In a new tab, type or paste '''about:config''' in the address bar and press Enter. Click the button accepting the risk. (2) In the search box above the list, type or paste '''edge''' and pause while the list is filtered (3) Double-click the '''print.printer_''BrandX''.print_edge_top''' preference and enter your desired distance in hundreds of an inch (assuming you use inch measurements). For example: * 10 => 1/10 inch * 25 => 1/4 inch In a different tab, use print preview to test that there is now that amount of space between the top edge of the paper and the page title. (4) Repeat for the '''print.printer_''BrandX''.print_edge_bottom''', '''print.printer_''BrandX''.print_edge_left''' , and '''print.printer_''BrandX''.print_edge_right''' preferences. If the edge preferences do not exist, or to hedge your bets, you can set the '''print.printer_''BrandX''.print_unwriteable_margin_bottom''', '''print.printer_''BrandX''.print_unwriteable_margin_left''' , '''print.printer_''BrandX''.print_unwriteable_margin_right''', and '''print.printer_''BrandX''.print_unwriteable_margin_top''' preferences similarly. That should allow you to accommodate any printer's "unprintable" area. Success?
Was this helpful to you? 0
Quote

Question owner

I can not adjust the printing margins: even changing the default values does not change anything. I refer to the space between the header, the footer, the right border and the left edge of the sheet and the body of the page text. With Chrome and with Edge I can do this in a moment, with Firefox it's impossible.

I can not adjust the printing margins: even changing the default values does not change anything. I refer to the space between the header, the footer, the right border and the left edge of the sheet and the body of the page text. With Chrome and with Edge I can do this in a moment, with Firefox it's impossible.
Was this helpful to you?
Quote

Question owner

I refer to the space under the heading and above the footer, that is, the space between these two elements and the text of the page to be printed, and the space between the two edges of the sheet, right and left, and the text of the page.

I refer to the space under the heading and above the footer, that is, the space between these two elements and the text of the page to be printed, and the space between the two edges of the sheet, right and left, and the text of the page.
Was this helpful to you?
Quote

Question owner

Another flaw in the print function of Firefox is that sometimes the print margins appear in inches (0.5), other times in millimeters (12.7): why?

Another flaw in the print function of Firefox is that sometimes the print margins appear in inches (0.5), other times in millimeters (12.7): why?
Was this helpful to you?
Quote
jscher2000
  • Top 10 Contributor
7925 solutions 64671 answers

giuseppeg1973 said

I can not adjust the printing margins: even changing the default values does not change anything. I refer to the space between the header, the footer, the right border and the left edge of the sheet and the body of the page text.

I'm not sure what you mean by the default values. The Page Setup dialog should work. Do you see any changes reflected in the preview after changing margins there? I tested using extreme 1" margins (first screenshot).

After entering settings there for the currently selected printer, you should see the values saved in about:config for your printer under:

  • print.printer_Printer_Name.print_margin_bottom
  • print.printer_Printer_Name.print_margin_left
  • print.printer_Printer_Name.print_margin_right
  • print.printer_Printer_Name.print_margin_top

Example in the second screenshot.

Is your Page Setup dialog not recording the changes to those preferences? Or is it recording them, but Firefox is not following them?

''giuseppeg1973 [[#answer-1179456|said]]'' <blockquote> I can not adjust the printing margins: even changing the default values does not change anything. I refer to the space between the header, the footer, the right border and the left edge of the sheet and the body of the page text. </blockquote> I'm not sure what you mean by the default values. The Page Setup dialog should work. Do you see any changes reflected in the preview after changing margins there? I tested using extreme 1" margins (first screenshot). After entering settings there for the currently selected printer, you should see the values saved in about:config for your printer under: * print.printer_''Printer_Name''.print_margin_bottom * print.printer_''Printer_Name''.print_margin_left * print.printer_''Printer_Name''.print_margin_right * print.printer_''Printer_Name''.print_margin_top Example in the second screenshot. Is your Page Setup dialog not recording the changes to those preferences? Or is it recording them, but Firefox is not following them?
Was this helpful to you? 0
Quote

Question owner

I do not understand what the second screen means. In any case I ran about: config and then I wrote in the search box "Pro.print_margin", but nothing appears to me.

I do not understand what the second screen means. In any case I ran about: config and then I wrote in the search box "Pro.print_margin", but nothing appears to me.
Was this helpful to you?
Quote
jscher2000
  • Top 10 Contributor
7925 solutions 64671 answers

Hi giuseppeg1973, the second screenshot shows where Firefox has saved the margin settings I entered into the Page Setup dialog in the first screenshot. I used Pro in my filter because that is the end of the name of my currently active printer; that simplified the screenshot to just the one printer. Since that doesn't match any of your printers, you can use print_margin to see the settings for all your printers, or match part of the name of your actual printer.

Hi giuseppeg1973, the second screenshot shows where Firefox has saved the margin settings I entered into the Page Setup dialog in the first screenshot. I used ''Pro'' in my filter because that is the end of the name of my currently active printer; that simplified the screenshot to just the one printer. Since that doesn't match any of your printers, you can use ''print_margin'' to see the settings for all your printers, or match part of the name of your actual printer.
Was this helpful to you?
Quote

Question owner

I tried to change the values after typing about: config and looking for print_margin, setting higher values than there were but nothing changed at all. But how is it possible that the print function of Firefox has been designed so badly? At this point, even if I wanted to change browser willingly, switching to Firefox, I have to return to Chrome, which is heavier on the resources of the PC (especially on the CPU) but with which you can change the printing margins in a moment.

I tried to change the values after typing about: config and looking for print_margin, setting higher values than there were but nothing changed at all. But how is it possible that the print function of Firefox has been designed so badly? At this point, even if I wanted to change browser willingly, switching to Firefox, I have to return to Chrome, which is heavier on the resources of the PC (especially on the CPU) but with which you can change the printing margins in a moment.
Was this helpful to you?
Quote
jscher2000
  • Top 10 Contributor
7925 solutions 64671 answers

I don't know why Page Setup isn't working for you.

What page are you testing on?

PDFs

Firefox doesn't apply margins to PDFs in the built-in PDF viewer; it simply prints what you see on screen. If you are trying to print a PDF and it isn't fitting, I suggest opening it in a stand-alone PDF viewer such as Adobe Reader. The download button on the viewer's black toolbar allows for that.

I don't know why Page Setup isn't working for you. What page are you testing on? '''PDFs''' Firefox doesn't apply margins to PDFs in the built-in PDF viewer; it simply prints what you see on screen. If you are trying to print a PDF and it isn't fitting, I suggest opening it in a stand-alone PDF viewer such as Adobe Reader. The download button on the viewer's black toolbar allows for that. <img src="https://prod-cdn.sumo.mozilla.net/uploads/images/2018-12-09-09-39-27-1d123a.png" width="500">
Was this helpful to you?
Quote

Question owner

I'm trying to print the following page: http://www.antimafiaduemila.com/rubriche/marco-travaglio/72630-memento-mori-travaglio.html, through the add-on Print Edit WE, with which I can select which parts of the page print and which are not. But this inability to adjust the margins of printing as I like it occurs in all the pages of other websites that I try to print.

I'm trying to print the following page: http://www.antimafiaduemila.com/rubriche/marco-travaglio/72630-memento-mori-travaglio.html, through the add-on Print Edit WE, with which I can select which parts of the page print and which are not. But this inability to adjust the margins of printing as I like it occurs in all the pages of other websites that I try to print.
Was this helpful to you?
Quote
jscher2000
  • Top 10 Contributor
7925 solutions 64671 answers

Hi giuseppeg1973, I'm just calling up print preview and I see the problem.

I don't know why that article runs over the header and footer areas. Looks like some style rules in the page are not being interpreted correctly -- when the rule says the top bar should be absolutely positioned at 0 pixels from the top of the page, that should be inside the margin and not all the way at the edge of the page where the header is.

If someone can figure out what causes it, we could file a better bug report. But if we can't, you could file a report giving the address of a page on the site if you like.

But that would put a fix at least 3 months away, so for now, unless someone else has a workaround, you'll have to print from that site using a different browser.

Hi giuseppeg1973, I'm just calling up print preview and I see the problem. I don't know why that article runs over the header and footer areas. Looks like some style rules in the page are not being interpreted correctly -- when the rule says the top bar should be absolutely positioned at 0 pixels from the top of the page, that should be ''inside'' the margin and not all the way at the edge of the page where the header is. If someone can figure out what causes it, we could file a better bug report. But if we can't, you could file a report giving the address of a page on the site if you like. But that would put a fix at least 3 months away, so for now, unless someone else has a workaround, you'll have to print from that site using a different browser.
Was this helpful to you?
Quote
jscher2000
  • Top 10 Contributor
7925 solutions 64671 answers

Okay, this took a long time to find.

There is a style rule sites can use to set the margins a specific distance from the edge of the page. This site uses:

@page {
    margin: .5cm
}

That overrides the Page Setup margin, the edge margin, everything, so the page content starts printing on top of or possibly above the header.

Firefox probably should not let pages do that, but I don't see a setting to prevent it from happening.

It's possible to override site rules like this by injecting your own rule. However, I'm still trying to figure out the best way to do that.

Okay, this took a long time to find. There is a style rule sites can use to set the margins a specific distance from the edge of the page. This site uses: @page { margin: .5cm } That overrides the Page Setup margin, the edge margin, everything, so the page content starts printing on top of or possibly above the header. Firefox probably should not let pages do that, but I don't see a setting to prevent it from happening. It's possible to override site rules like this by injecting your own rule. However, I'm still trying to figure out the best way to do that.
Was this helpful to you?
Quote
jscher2000
  • Top 10 Contributor
7925 solutions 64671 answers

This script is an example of how to modify the problem margin setting in the page:

https://gist.github.com/jscher2000/3fd7af422ab57b6b5c63ffb22824b623

You could run this on an ad hoc basis when you notice the problem in Print Preview, or you could use a user script host extension (like Tampermonkey) to apply it to every page automatically. I'm not sure what makes the most sense because there may be some sites that have logical values and do not need to be overridden with standard values.

Note: This demo page is simpler than working with the articles on the website. https://www.jeffersonscher.com/sumo/bugs/page-margin.html

This script is an example of how to modify the problem margin setting in the page: https://gist.github.com/jscher2000/3fd7af422ab57b6b5c63ffb22824b623 You could run this on an ad hoc basis when you notice the problem in Print Preview, or you could use a user script host extension (like Tampermonkey) to apply it to every page automatically. I'm not sure what makes the most sense because there may be some sites that have logical values and do not need to be overridden with standard values. Note: This demo page is simpler than working with the articles on the website. https://www.jeffersonscher.com/sumo/bugs/page-margin.html

Modified by jscher2000

Was this helpful to you?
Quote

Question owner

Ok, thanks for the time you have dedicated to my problem with Firefox. Too bad that there is not a solution, because I noticed that Firefox, compared to Chrome, uses much less the CPU of my notebook (not a little 'less, but MUCH less), with the result that the battery itself lasts significantly more if I surf with Firefox rather than Chrome. But I need a browser that prints well any page I want or should print, and this, to date, can do Chrome. I hope the Firefox development team will introduce substantial improvements to Firefox's print functionality as soon as possible, so that such problems do not arise with any website.

Ok, thanks for the time you have dedicated to my problem with Firefox. Too bad that there is not a solution, because I noticed that Firefox, compared to Chrome, uses much less the CPU of my notebook (not a little 'less, but MUCH less), with the result that the battery itself lasts significantly more if I surf with Firefox rather than Chrome. But I need a browser that prints well any page I want or should print, and this, to date, can do Chrome. I hope the Firefox development team will introduce substantial improvements to Firefox's print functionality as soon as possible, so that such problems do not arise with any website.
Was this helpful to you?
Quote
jscher2000
  • Top 10 Contributor
7925 solutions 64671 answers

As a temporary workaround, you can use this bookmarklet. A bookmarklet is a script you install on your Bookmarks Menu or Bookmarks Toolbar. When you see there is a problem with margins in Print Preview, cancel, then click the bookmarklet button to run a script against the page. Then try Print Preview again.

https://www.jeffersonscher.com/res/sumomarklets.html#marginfix

Currently that is set for 1.27cm top/bottom and 0.64cm left/right. Those distances should clear Firefox's header/footer so you can read the text.

(Firefox has other printing problems, so this is just directed to the one affecting the site discussed in this thread.)

As a temporary workaround, you can use this bookmarklet. A bookmarklet is a script you install on your Bookmarks Menu or Bookmarks Toolbar. When you see there is a problem with margins in Print Preview, cancel, then click the bookmarklet button to run a script against the page. Then try Print Preview again. https://www.jeffersonscher.com/res/sumomarklets.html#marginfix Currently that is set for 1.27cm top/bottom and 0.64cm left/right. Those distances should clear Firefox's header/footer so you can read the text. (Firefox has other printing problems, so this is just directed to the one affecting the site discussed in this thread.)

Modified by jscher2000

Was this helpful to you?
Quote

Question owner

But I would like to be able to adjust the printing margins as I like it, I do not want the header and footer to be eliminated: if so, then I might as well copy what I have to print and paste it in Word, then print from there.

But I would like to be able to adjust the printing margins as I like it, I do not want the header and footer to be eliminated: if so, then I might as well copy what I have to print and paste it in Word, then print from there.
Was this helpful to you?
Quote
jscher2000
  • Top 10 Contributor
7925 solutions 64671 answers

Helpful Reply

Sorry, I didn't mean "clear" as in delete, I meant "clear" as in leave enough space for them. Anyway, feel free to try it and let me know if you would like to adjust the values I used.

Sorry, I didn't mean "clear" as in delete, I meant "clear" as in leave enough space for them. Anyway, feel free to try it and let me know if you would like to adjust the values I used.
Was this helpful to you? 1
Quote

Question owner

Thanks, I did as you told me and now the margins are definitely improved, especially up and down, less on the sides, but I still find them slightly narrow both above and below, while they are a bit 'too close to the right and left : as default values I would like to set 1.4 cm on all 4 sides of the page, as I did on Chrome.

Thanks, I did as you told me and now the margins are definitely improved, especially up and down, less on the sides, but I still find them slightly narrow both above and below, while they are a bit 'too close to the right and left : as default values I would like to set 1.4 cm on all 4 sides of the page, as I did on Chrome.
Was this helpful to you?
Quote
jscher2000
  • Top 10 Contributor
7925 solutions 64671 answers

Helpful Reply

You can copy the following updated script and then right-click your bookmarklet, delete the Location text, and paste the new one.

javascript:var docSS=document.styleSheets,ss,ess; for(var i=0;i<docSS.length;i++){if(!docSS[i].disabled){ss=docSS[i]; for(var j=0;j<ss.cssRules.length;j++){if(ss.cssRules[j].type==6){if(ss.cssRules[j].cssText.indexOf('margin')>-1){ss.cssRules[j].style.margin='1.4cm 1.4cm';}} else if(ss.cssRules[j].type==4){ess=ss.cssRules[j]; for(var k=0;k<ess.cssRules.length;k++){if(ess.cssRules[k].type==6){if(ess.cssRules[k].cssText.indexOf('margin')>-1){ess.cssRules[k].style.margin='1.4cm 1.4cm';}}}}}}} void 0;

Note: that is intended to be one long line, so if your email breaks lines, you should copy from the forum instead.

You can copy the following updated script and then right-click your bookmarklet, delete the Location text, and paste the new one. javascript:var docSS=document.styleSheets,ss,ess; for(var i=0;i&lt;docSS.length;i++){if(!docSS[i].disabled){ss=docSS[i]; for(var j=0;j&lt;ss.cssRules.length;j++){if(ss.cssRules[j].type==6){if(ss.cssRules[j].cssText.indexOf('margin')>-1){ss.cssRules[j].style.margin='1.4cm 1.4cm';}} else if(ss.cssRules[j].type==4){ess=ss.cssRules[j]; for(var k=0;k&lt;ess.cssRules.length;k++){if(ess.cssRules[k].type==6){if(ess.cssRules[k].cssText.indexOf('margin')>-1){ess.cssRules[k].style.margin='1.4cm 1.4cm';}}}}}}} void 0; Note: that is intended to be one long line, so if your email breaks lines, you should copy from the forum instead.
Was this helpful to you? 1
Quote
Ask a question

You must log in to your account to reply to posts. Please start a new question, if you do not have an account yet.