简体   繁体   中英

Print webpage from vb.net

I am trying to write a code in vb.net that can print a webpage url to a printer.

I also would like to choose which printer.

This is the code i have so far.

`
Dim pr As New ProcessStartInfo
pr.FileName = "chrome.exe"
pr.Arguments = "http://www.google.com"
Process.Start(pr)

`

This open the webpage in chrome. It also works with internet explorer if i change to iexplorer.exe instead. But i can not make it print the webpage. I have searched the internet but i can not find anything what would work.

Anybody who knows?

Printing through Chrome will be easy if you prompt PrintFileDialog but for printing the file to PDF, i suggest you to use Universal Document Converter tool that has virtual PDF printer or similar to this tool.

Other method is to do the stuff, this link will help you! MSDN - Printing a Rendered webpage

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM