Greetings,
Does anyone know how to Preview a HTML page with api and then eventualy print it ?
Thanks in advance!
-Lumin
Printable View
Greetings,
Does anyone know how to Preview a HTML page with api and then eventualy print it ?
Thanks in advance!
-Lumin
Use the Webbrowser Control.
First create the page:
Then, in the Custom Controls list, choose Microsoft Internet Controls.Code:Open "C:\htmlpage.htm" For Output As #1
Print #1, Text1.text
Close #1
And then navigate to the file:
Webbrowser1.Navigate "C:\htmlpage.htm"
And then have a print button:
Code:Private Sub CmdPrint_Click()
WebBrowser1.ExecWB OLECMDID_PRINT, _
OLECMDEXECOPT_PROMPTUSER
'If you don't want to prompt the user to print:
'WebBrowser1.ExecWB OLECMDID_PRINT, _
OLECMDEXECOPT_DONTPROMPTUSER
End Sub
Thanks, But im trying to avoid using the webbrowser control since its taking space and my program should take as little KB as possible. :)
So I was wondering if windows has any Dll's I can call up instead. since windows usualy has Dll'd loaded for almoust evrything I would expect it to have a dll with these kind of functions. or am I expecting to much of windows now ? :D
Anyway thanks for the help.
-Lumin
Oh dang it.. I didn't read your post entierly .. sorry gona try your sugjestion now
Thanks!!
-Lumin
You can avoid the Webbrowser Control.
What you can do...is reference it instead. So you don't have to use the control on your form, but rather, open IE and preview it from there.
That is probably one of the closest ways that you can get to being able to preview and print it. And the user can just use the IE window's Printing.Code:'Form Declarations:
Dim ie As New Internet Explorer
Private Sub cmdPreview_Click()
ie.Navigate "C:\htmlpage.htm"
ie.Visible = True
End Sub
^I assume it'd work the same way as the Webbrowser Control.Code:Private Sub CmdPrint_Click()
ie.ExecWB OLECMDID_PRINT, _
OLECMDEXECOPT_PROMPTUSER
'If you don't want to prompt the user to print:
ie.ExecWB OLECMDID_PRINT, _
'OLECMDEXECOPT_DONTPROMPTUSER
End Sub
It may still take up space, but I don't think your going to find any other way. There are controls out there that can print and have a print preview on them, you may want to look for them if you don't like my way.
But, I'm just giving you suggestions :rolleyes:.