Avatar of DanCooperstock
DanCooperstock asked on

Print formatting progress in embedded MS WebBrowser control

I'm embedding a WebBrowser control in an application, which happens to be PowerBuilder (but I don't think that's relevant to this question - the same issues would appear in, say, VB).

I'm then loading a document (which is actually a mail-merged document, and may be a many pages long), and giving the user an option to print it to PDF using a PDF printer SDK.

That PDF SDK gives me progress messages at the end of each page printed, so I can put up a message like "Printed page N of M". However, with very long documents, those messages don't start for a long time (like, over a minute for one 240-page document), and then they all go by quite quickly.

That makes me think that the WebBrowser control is spending a lot of time internally formatting the document for the printer, before it starts spooling it to the printer at all. Is there any way to get any progress messages out of the WebBrowser control for this, to give the user a better notion of progress?

I have investigated the progresschange event, but that only fires while loading documents.

I'm guessing that the answer to this is that there is no way to do this, but I thought it might be worth asking in case there is something I have overlooked. Thanks.

Avatar of undefined
Last Comment

8/22/2022 - Mon

how is the html page formatted? does it have lots of tables?

Are you using the webbrowser control as a print preview? If not you could try using SharpPDF or other such utils to print your HTML directly as pdf rather than using the webbrowser control. This would be way faster

It's not that the web page has lots of tables (which it usually doesn't), just that it can be very long, because I'm using it for mail merging letters, so there might be 100 or more pages to print.

Yes, I am using the WebBrowser control both for preview and to allow the user to further edit the letters, in case they want to personalize them or something. So I think I do need to print from it.

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.