Send a HTML file to printer

Hi !

I want to know what is the simplest and faster way to print a HTML file in VB, without opening it in the default web browser.



Who is Participating?
Have you tried shellexecute API:

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Private Sub Command1_Click()
Call ShellExecute(hwnd, "Print", ("C:\Somefile.html"), "", "",0)
End Sub
fregAuthor Commented:
Ok it works.  You answered the question literally, but in fact i need a bit more control, like choosing orientation or paper size, and send it directly to the printer, without dialog window (printer dialog)... is it possible ?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.