为提升您的使用体验,本站正在维护,部分功能暂时无法使用。如果本站文章无法解决您的问题,您想要向社区提问的话,请到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 提问,我们的支持社区将会很快回复您的疑问。

搜索 | 用户支持

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

详细了解

Firefox 17 on Windows 7 prints blank pages after printing selection

more options

I need to be able to highlight text on a webpage and print only that text using the print selection inside the file/print tab. However, instead, I am getting only that highlighted text AND then blank pages (with headers and footers) keep printing (how many pages that print depends on the actual size of the webpage). I have Windows 7, 32bit and Firefox 17. I updated Firefox this morning and restarted but the problem still exists. I did not have this problem when I had Windows XP. The print selection works properly in IE9.

I need to be able to highlight text on a webpage and print only that text using the print selection inside the file/print tab. However, instead, I am getting only that highlighted text AND then blank pages (with headers and footers) keep printing (how many pages that print depends on the actual size of the webpage). I have Windows 7, 32bit and Firefox 17. I updated Firefox this morning and restarted but the problem still exists. I did not have this problem when I had Windows XP. The print selection works properly in IE9.

所有回复 (2)

more options

Firefox's Print Selection feature has always left much to be desired...

What I get is blank pages before the selection but not after. You get blank pages for the entire document? That's especially unhelpful.

I am aware of two workarounds. Each isolates the selection by itself so you can print it normally, i.e., without choosing Print Selection.

Nuke Anything Enhanced

After installing this add-on, when you have a selection and right-click it, you can choose "Remove everything else" to isolate the text for printing. Note that you need to reload the page to see the rest of the content again.

Bookmarklet

Before learning about the above, I wrote a small script to isolate the selection for printing. I wouldn't use it if you are filling in a form, making a purchase, etc., since the script duplicates part of the page and this may break the form. On the other hand, at least there is some level of undo without reloading the page.

If you want to try it, here are the steps:

(1) Select and copy the following line of script (it's all one long line):

javascript:var sel=window.getSelection(); if(!sel.isCollapsed){var rng=sel.getRangeAt(0); if(!rng.collapsed){var docfrag=rng.cloneContents(); if(!document.getElementById("divHideMe")){var rng2=document.createRange(); rng2.selectNodeContents(document.body); var myContainer=document.createElement("DIV"); rng2.surroundContents(myContainer); myContainer.setAttribute("id","divHideMe"); rng2.detach();} myContainer.style.display="none"; if(document.getElementById("printFrag")){var myFrag=document.getElementById("printFrag"); while(myFrag.firstChild) {myFrag.removeChild(myFrag.firstChild);} myFrag.style.display="block";}else{var myFrag=document.createElement("DIV"); myFrag.setAttribute("id","printFrag"); document.body.appendChild(myFrag);} myFrag.appendChild(docfrag); rng.detach(); var myP=document.createElement("P"); myFrag.appendChild(myP); myP.setAttribute("id","killBtn"); var myBtn=document.createElement("INPUT"); myP.appendChild(myBtn); myBtn.setAttribute("type","button"); myBtn.setAttribute("value","Return to Page"); myBtn.setAttribute("onclick","document.getElementById('divHideMe').style.display='block'; document.getElementById('printFrag').style.display='none';"); myStyle=document.createElement("STYLE"); myFrag.appendChild(myStyle); myStyle.setAttribute("type","text/css"); myStyle.setAttribute("media","print"); myStyle.innerHTML="#killBtn{display:none}";}} void 0;

(2) Right-click the Bookmarks Toolbar and choose New Bookmark. (If you do not ordinarily display the Bookmarks Toolbar, you can add it to the menu instead. Whatever will be convenient.)

(3) Click in Location and paste the script.

(4) Click in Name and name it whatever you like (I call it Crop4Print) and then click Add.

Now after selecting text, click the bookmarklet button to hide the rest of the page.

more options

Note: prior to Firefox 11, the extra pages were omitted. Perhaps you were running Firefox 10 on your XP system?

Examples of threads from the time of Firefox 11:

由jscher2000 - Support Volunteer于修改