views:

69

answers:

3

I have HTML document to print from embedded COM IWebBrowser object.
And although in IE itself it printed with correct page breaks (by page-break-inside in CSS).
In my application it make it wrong.

I'm already dig it much. Can you suggest something?

+1  A: 

I don't know if this is your scenario (since it is a bit ambiguous), but I had an IE page being generated by Javascript, using the DOM and found in some cases that Javascript (or IE's DOM) was adding breaks after every append, or some such, where it wasn't supposed to. I was able to work-around the problem by building my string in memory first, and only sending it where it was needed once the string was completely built.

Andy Jacobs
its not my case I need to print preserved page And yet... where you run your JavaScript? From IE or from WebBrowser interface to it? As it seems, its just a nasty bug with IE COM -- in IE itself it was fixed, but in the WebBrowser COM not :(
My scenario was a Vista Gadget, running javascript on the web page to generate the HTML for a flyout page. But since the bug may have been from the DOM interface, I thought it was worth suggesting this as a possiblity, even if our scenarios are not identical. Good luck.
Andy Jacobs
A: 

You may use print templates for control your printing flow.

necrostaz
Yes. I was discovered such possibility but it is not an answerOnly If you can give me correct example or code snippet I can insert into my print template to get correct page breaks
A: 

It may have to do with the DOCTYPE.

Nathan