The problem that you’re running into comes from the ways that the two browsers maintain information about their current state. In Internet Explorer, the browser actually manipulates the internal document whenever a change is made, which is part of the reason that you can set the innerHTML of any entity within the page and still have it appear in print. With the Netscape browser, on the other hand, the system only maintains the initial state of the document, and any modifications made are changes to the output, not the document. In other words, if I set the contents of a layer once the document has been displayed, I only change the display?the document remains static.
The solution, unfortunately, isn’t a pretty one. In order to output a modified page to the printer, you need to create the same document in HTML. Luckily it sounds like you’ve already done most of the precursor work for this task yourself. First you need to create a buffer of HTML output that mirrors the document currently in memory. Then you open a new window and pump the contents of the new pseudo-page into the window as a separate document. In general, it’s best to separate the accumulation of the text (or the building of the page) from the mechanics of opening the window and displaying the contents.
As I said, it’s not a terribly elegant solution, but until Netscape formally adopts the W3C HTML Object model sometime later this year with Netscape 5, it’s about the only option that’s available.