views:

24

answers:

1

In internet explorer 6+, I am trying to make a mark on the left border where an element appears in the text. This currently works by putting an image at the absolute position with an X of 5px and a Y which is the absolute position of the element, worked out by navigating up the offsetParents and margins of all the parents up to the root.

This works fine on screen, everything is in the right place.

However, when I go to print it I have to use a template with a header and footer. Internet explorer deals with putting the headers and footers on the document and I never seem to have access to the file it has generated and prints.

Is there some way I can ensure these lines stay in place?

+1  A: 

Stuff you do to the DOM after the page has loaded won't be reflected in the printed output. What you can do, or I should say, what you can try to do, is to create a new page in a popup window using Javascript. That way, you can create a new DOM in that new page that has whatever computed content you like. Then have the user choose to print that.

Now, that said, I suspect you'll still find that the control you have over the look of the printed version is very limited. Browsers have been making all sorts of progress (though you're talking about IE6 here, I realize) but printing remains quite primitive. On top of that, the very concept of absolute positioning gets a little funny when you're talking about paged media (ie, print).

Pointy
Thanks. Unfortunately I am prevented from doing that by the requirements (which are stupid, but sadly that is out of my hands). I think I will have to start putting eveything in tables so I can mark the left border, as where they are in tables they work fine
Woody