html to PDF using VBS
I need a .VBS example of how to read in an html file into Acrobat DC and then save the file as a PDF.
I need a .VBS example of how to read in an html file into Acrobat DC and then save the file as a PDF.
Here is the code me and another guy came up with. It works entirely in the background so you won't see an Acrobat icon while it is converting the html file into a pdf. I hope you like it.
Option Explicit
Dim AcroApp
Dim objAVDoc
Dim objPDDoc
Set AcroApp = CreateObject("AcroExch.App")
AcroApp.Hide
Set objAVDoc = CreateObject("AcroExch.AVDoc")
'Input file path
objAVDoc.Open "C:\Temp\Do_Loop_Example.html", ""
Set objPDDoc = objAVDoc.GetPDDoc
'Output file path
objPDDoc.Save 1, "C:\Temp\Do_Loop_Example.pdf" 'Explicit save.
objPDDoc.Close
objAVDoc.Close -1 'Close without saving -- an explicit save was already invoked.
Set objPDDoc = Nothing
Set objAVDoc = Nothing
AcroApp.Exit
Set AcroApp = Nothing
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.