This is something I created in response to a thread on the mozillaZine forums, but thought that some Lounge users might want to try out.
The problem is that when printing a selection, Firefox often maintains the relative position of the material. This can cause it to run past the right margin or simply to be in an illogical location on the page.
The workaround is to snip out the selection, hide the rest of the document, and have just the selected material on the page. The quickest way to make the necessary script code available in Firefox is to create a "bookmarklet". The following is some pretty rough "beta" code, but it works in my little test so far. (In Firefox; not tested elsewhere.) After printing, you have to reload the page to return it to normal.
Here's how you can install it:<UL><LI>Open the Bookmarks Manager dialog (Bookmarks>Organize Bookmarks...)
<LI>Click Bookmarks at the top of the "tree" in the left column, then click the New Bookmark button
<LI>Copy and paste this into the Name space, or choose a Name you like:
<code>Crop4Print v0.2</code>
<LI>Copy and paste the following into the Location space:
<code>java script:var sel=window.getSelection(); if(!sel.isCollapsed){var rng=sel.getRangeAt(0); if(!rng.collapsed){var docfrag=rng.cloneContents(); var rng2=document.createRange(); rng2.selectNodeContents(document.body); var myContainer=document.createElement("DIV"); rng2.surroundContents(myContainer); myContainer.setAttribute("id", "hideMe"); myContainer.style.display="none"; rng2.detach(); document.body.appendChild(docfrag); rng.detach();}} void 0;</code>
<LI>Copy and paste the following into the Description space (it's the URL to the mozillaZine thread, in case problems or questions come up in the future):
<code>http://forums.mozillazine.org/viewtopic.php?t=513572</code>
<LI>Click OK to save it[/list]The way bookmarks sort in the Bookmarks Manager and on the menu is somewhat unpredictable. It should be there somewhere. <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
To test it out, select something on a page and then run the bookmarklet. It should move the selected material to the left side and "white out" the rest of the page. Sometimes it takes 5-8 seconds, for no apparent reason. It's possible that there will be color problems because the selection is taken out of its original context... I look forward to feedback.



