|
Rank: Member Groups: Member
Joined: 9/26/2023 Posts: 10
|
What is the purpose of webview1.print? When does it work and do I have to have it open in a browser? or can I print without a browser just using webview1?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,188
|
Hi,
WebView IS the browser engine. You can use it to display a web page (and print it if you want to) in your application. You can also use it load page off screen and then do other things such as examine the page, automate login, etc. Internally our HTML to PDF converter uses WebView to render a page to PDF.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 9/26/2023 Posts: 10
|
My programming is pretty simple: WebView.LoadHtml(MyString) WebView.Print(MyPrinterSettings, MyPageSetitngs)
It does nothing. I even tried putting in the event handler to make sure it was done loading but I can't even get that to fire.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,188
|
Hi, All the calls are asynchronous. So you will need to wait for it to finish. For example:
Code: C#
//Use LoadHtmlAndWait instead of LoadHtml
webView.LoadHtmlAndWait(MyString);
//Call WaitOne after you call Print
webView.Print(MyPrinterSettings, MyPageSetitngs).WaitOne();
Thanks!
|
|
Rank: Member Groups: Member
Joined: 9/26/2023 Posts: 10
|
It now stops at the first line and will not continue. I then remove the 'AndWait' from the load line and it permanently stops at the print line.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,188
|
How did you create your WebView object?
|
|
Rank: Member Groups: Member
Joined: 9/26/2023 Posts: 10
|
VB.net 'Dim WebView As New WebView
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,188
|
|
|
Rank: Member Groups: Member
Joined: 9/26/2023 Posts: 10
|
I have a form with a webcontrol in it, I then a webview into the webcontrol and load the page. All works well. When I use the webview.print, it prints be not in color. The logo prints in color but not colored buttons (maybe background color option?). Any ideas why and what I can do?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,188
|
Hi, This is just how web page printing works. By default the browser engine automatically adjust background when printing to save ink. You can turn off such adjusting with the following CSS rule:
Code: CSS
body{
-webkit-print-color-adjust:exact !important;
print-color-adjust:exact !important;
}
Please let us know if this works for you. Thanks
|
|