webbrowser control / printing |
Post Reply |
Author | ||
fuxi
Groupie Joined: 15 December 2008 Location: Germany Status: Offline Points: 21 |
Post Options
Thanks(0)
Posted: 12 June 2009 at 10:24am |
|
hi all,
i managed to display + print data but here's my problem: i'd like to do somekind of serial printing - the problem: printing gives me missing + blank pages. i'm doing it like this: for page=1 to 20 with mybrowserWrapper .generate_page page ' i'm generating html data out of a database .show ' i'm now saving the html data to a tmpfile, loading it to the control using .navigate tmpfile ' the html appears, and i'm using Do While htm.Busy: DoEvents: Loop to determine when it has finished loading .printIt ' i'm printing like this: htm.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER end with next the code seems ok, but there's something with printing, either the printing routine starts before it gets data (blank pages) or it's skipping pages (the loop continues before printing has finished). i'm not sure where to find the problem :/ but i guess i need to wait until print has finished before i generate the next page. anyone knows how to do it? thanks, fuxi |
||
Krog
Groupie Joined: 06 February 2008 Status: Offline Points: 100 |
Post Options
Thanks(0)
|
|
Hi!
This is the way the WebBrowser control handles printing: By default, the ExecWB() method passes a copy of the document to a separate thread, which then performs the actual printing. In this way the ExecWB() method returns immediately, without waiting for the thread to finish, and if the browser is destroyed while printing is still in progress, only part of the contents will be printed. You can use the following constants:
These can be used to enhance the print function. For example: PRINT_WAITFORCOMPLETION can be used to wait until the pages have been sent to the printer before continuing (especially useful if you want to restore the original header/footer) and PRINT_DONTBOTHERUSER can be used to hide all print dialogs. So the code may look like this:
There is more info in the MSDN link bellow: http://msdn.microsoft.com/en-us/library/aa769937(VS.85).aspx |
||
Product: Xtreme SuitePro (ActiveX) version 15.2.1
Platform: Windows XP SP2 Language: Visual Basic 6 SP6 |
||
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |