搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

The Firefox built in PDF Viewer displays the document with a border of 9px around. Is there a way to remove this border?

  • 5 个回答
  • 1 人有此问题
  • 1 次查看
  • 最后回复者为 aFireFox

more options

I have a PDF document which has an A4 page dimension displayed in the Firefox build in PDFViewer. The text on it is exactly positioned and should stay that way when printed as well. Originally when printing, the page was shrinked and had a bigger border. Now I found out that it was partially related to the print_shrink_to_fit flag, that you can define specific for the printer in about:config. The print dialog did not allow me to change the flag, so I changed it in about:config to flase. But now I still have the problem that the document has a border which is not part of the document and shifts the text to the bottom and right. Using "inspect element" in the Firefox browser I found the border defined in the class pdfViewer in the viewer.css file which is part of the internal PDF viewer I believe. I have not found any option which allows me to remove that border. Can you tell me how to do this? I'm working on Windows 10 with the most current Firefox 55.0.3 32bit browser.

I have a PDF document which has an A4 page dimension displayed in the Firefox build in PDFViewer. The text on it is exactly positioned and should stay that way when printed as well. Originally when printing, the page was shrinked and had a bigger border. Now I found out that it was partially related to the print_shrink_to_fit flag, that you can define specific for the printer in about:config. The print dialog did not allow me to change the flag, so I changed it in about:config to flase. But now I still have the problem that the document has a border which is not part of the document and shifts the text to the bottom and right. Using "inspect element" in the Firefox browser I found the border defined in the class pdfViewer in the viewer.css file which is part of the internal PDF viewer I believe. I have not found any option which allows me to remove that border. Can you tell me how to do this? I'm working on Windows 10 with the most current Firefox 55.0.3 32bit browser.

被采纳的解决方案

You can remove the border with code in userContent.css.

Add code to the userContent.css file.


.pdfViewer .page { border: 0px !important; }

You can use the button on the "Help -> Troubleshooting Information" (about:support) page to go to the current Firefox profile folder or use the about:profiles page.

  • create the chrome folder (lowercase) in the <xxxxxxxx>.default profile folder if this folder doesn't exist
  • use a plain text editor like Notepad to create a (new) userContent.css file in the chrome folder (file name is case sensitive)
  • paste the code in the userContent.css file in the editor window
  • make sure that you select "All files" and not "Text files" when you save the file via "Save file as" in the text editor as userContent.css.
    otherwise Windows may add a hidden .txt file extension and you end up with a not working userContent.css.txt file
定位到答案原位置 👍 0

所有回复 (5)

more options

I think that there is a script running on the page that automatically sets the width in such a way that you always get a border. You can see this in the Inspector in the width rules for div.page If you change the width of the Firefox window then the width gets adjusted.

more options

Hi cor-el, Thanks for your reply. Unfortenately it does not help. I used the Inspector to actually see that in viewer.css the 9px border is set for ".pdfViewer .page". This is the container for a page. So I'm looking for a way to remove that border or overwrite that setting. With that setting, pages are not printed correctly because it does not really reflect the document. At least I assume that it's that setting which moves the text to the right and bottom slightly on my printout. In viewer.css is another definition for ".pdfViewer.removePageBorders .page". Here I have no borders and I see in the viewer.js script I can see that there is a way to use it. But I can't see how I can get Firefox to take the path to use that setting. Do you have any idea about that?

more options

选择的解决方案

You can remove the border with code in userContent.css.

Add code to the userContent.css file.


.pdfViewer .page { border: 0px !important; }

You can use the button on the "Help -> Troubleshooting Information" (about:support) page to go to the current Firefox profile folder or use the about:profiles page.

  • create the chrome folder (lowercase) in the <xxxxxxxx>.default profile folder if this folder doesn't exist
  • use a plain text editor like Notepad to create a (new) userContent.css file in the chrome folder (file name is case sensitive)
  • paste the code in the userContent.css file in the editor window
  • make sure that you select "All files" and not "Text files" when you save the file via "Save file as" in the text editor as userContent.css.
    otherwise Windows may add a hidden .txt file extension and you end up with a not working userContent.css.txt file
more options

Hi cor-el, I tried it and it seems to apply the changes. Unfortunately it does not solve my original problem: The text is moved to the right and bottom just slightly. I thought that it has to be that border setting. But as it turns out, it's not that. Do you have any idea what else it could be? In the pdf I have a left border of 15mm, but in the print out (without userContent.css) it always ended up to be about 20mm. Similar with the top border. Printing it from Adobe Acrobat generates a correct printout. Any idea?

more options

cor-el, I'm confused. I played around with the setting in userContent.css. I actually changed the setting to .pdfViewer .page { border: 4px solid red !important; } The change appears on the screen, nice red border. But it does not show up on the print out. Why?