I want to print an html file to the default printer with powershell. So lets say I have the file c:\test.html with the text:
<html>
<p> hello <b>world</b></p>
<html>
How could I print test.html to the default printer?
Thank you in advance.
I want to print an html file to the default printer with powershell. So lets say I have the file c:\test.html with the text:
<html>
<p> hello <b>world</b></p>
<html>
How could I print test.html to the default printer?
Thank you in advance.
get-content c:\test.html | out-printer
Print to default printer.
Edit:
if you need print rendered htlm page:
$ie = new-object -com "InternetExplorer.Application"
$ie.Navigate("c:\test.html")
$ie.ExecWB(6,2)
Edit after comments:
I can run this in a testprint.ps1 file:
$ie = new-object -com "InternetExplorer.Application"
$ie.Navigate("c:\test.html")
while ( $ie.busy ) { Start-Sleep -Seconds 3 }
$ie.ExecWB(6,2)
while ( $ie.busy ) { Start-Sleep -Seconds 3 }
$ie.quit()