Link to home
Start Free TrialLog in
Avatar of matrix_aash
matrix_aashFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Printing HTML files in VB.NET

Hi,

I want to be able to print an HTML file from a location (for this example we will say "C:\test.html"). I want to be able to set the printer settings such as orientation, margins etc and if i can, choose what printer it comes out on. I have tried playing around with the printer control but cannot seem to work it out.

Also if possible, if there a way you can track the progress of the print?

Thanks in advance!
Avatar of vadim63
vadim63
Flag of United States of America image

HTML source, or web page itself?
Avatar of matrix_aash

ASKER

My application generates HTML, saves it to C:\test.html and now i want to print test.html
ASKER CERTIFIED SOLUTION
Avatar of vadim63
vadim63
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It is my solution althought it print out saying "C:\test.html" on the page.
I want to print html file not webpage itself.
Actually this is not what I want. I just saw one method
ShellExecute(IntPtr.Zero, "print", @filePath, "", Directory.GetDirectoryRoot(filePath), SW_SHOWNORMAL)
When i am trying to run this method, its not giving me any error but its not printing anything.
Is anybody got anyidea why? Or please tell me other alternative to print html file from webpage.