Webbrowser scale and print content
Hi. In my application, I have a WebBrowser in which I load a webpage. This works fine, but now I want to scale the page (if the content is larger then my control) and then print the page (scaled, so that it fits to exactly one page).
You can open the PrintDialog, but I want to do all this without user-interaction. Any ideas about that?
Re: Webbrowser scale and print content
Are you generating the HTML that is shown in the browser control?
The job of the browser control is to display your HTML. If your HTML is wrapped in tables with fixed width <table width="600"> then its not going to scale. Using <table width="100%"> will scale to the size of the control.
Images work the same way...
Or perhaps you are trying to show a preview type display of the webpage?
This may help: http://code.google.com/p/csexwb2/
Re: Webbrowser scale and print content
Thanks for your reply. What I need is more like the zoom you find in IE7 at the right bottom, but done programmatically. This scales even images and pixel-layouts.
Is this possible with the tool you mentioned?
Re: Webbrowser scale and print content
Cant you override the paint function of the web browser and use matrices to zoom?
Re: Webbrowser scale and print content
I too have been trying to scale the WebBrowser display.
I am still trying to work out the values, but the following will change the scale.
I can only get this to display at one biger size.
WebBrowserControl is the name of my WebBrowser control
Code:
Dim pvaIn As Variant
Dim pvaOut As Variant
pvaIn = Null
pvaOut = Null
Call WebBrowserControl.ExecWB(OLECMDID_OPTICAL_GETZOOMRANGE, OLECMDEXECOPT_DODEFAULT, pvaIn, pvaOut)
'Call WebBrowserControl.ExecWB(OLECMDID_OPTICAL_ZOOM, OLECMDEXECOPT_DODEFAULT, pvaIn, pvaOut)
MsgBox "pvaIn= " & pvaIn & vbCrLf + "pvaOut= " & pvaOut, , 1
pvaIn = pvaOut '* 1
pvaIn = 65536010
Call WebBrowserControl.ExecWB(OLECMDID_OPTICAL_ZOOM, OLECMDEXECOPT_DODEFAULT, pvaIn, pvaOut)
MsgBox "pvaIn= " & pvaIn & vbCrLf + "pvaOut= " & pvaOut, , 2