PDA

Click to See Complete Forum and Search --> : How to print a .html file


Pallex
Feb 7th, 2003, 10:51 AM
I've tried using :

result = ShellExecute(Me.hwnd, "PRINT", "REP.HTM", "", "", -1)

but that involves the user having to click `ok` , which I don't want.

I've also tried the WebBrowser control, but that doesn't let you print if you have a more recent version of the browser than v4 or so. (Needs to work on v5 onwards browser).

There must be a simple way of printing .html files?!

RealisticGraphics
Feb 7th, 2003, 04:21 PM
Are you just wanting to put a button or link on your webpage that will allow the user to print it? If so, use this:


<script language="JavaScript">
function PrintPage(){
window.print()
}
</script>

<a href="javascript: PrintPage()">Click to print this page</a>


This will display the print window to the user.

Pallex
Feb 10th, 2003, 04:02 AM
thanks but no, i want to add a control/some code to a vb program.
Ideally i`d like to be able to alter (for just the document being printed) properties such as landscape/portrait etc.