Knowledgebase: Developer
Convert HTML to PDF from Powershell Script
Posted by Craig Lebakken on 30 May 2018 11:30 AM

How can I convert an HTML to PDF from a script?

The following PowerShell script uses Internet Explorer to render and convert an HTML file ( in the example) to PDF:

$ie = new-object -com "InternetExplorer.Application"
while ( $ie.busy ) { Start-Sleep -second 3 }
$ie.visible = $true
Start-Sleep -second 3
while ( $ie.busy ) { Start-Sleep -second 3 }

The script only works if Win2PDF is set to the default printer.  To avoid the Win2PDF File Save pop-up, you can enable the auto-name feature.

(2 vote(s))
Not helpful

Comments (0)

Copyright 2000-2018 © Dane Prairie Systems LLC. All Rights Reserved. About Us | Privacy Policy | PDF Blog | Site Map