Yes. I think you can open the html in a browser then use “Print” to print to PDF. Or there might be a Save As PDF feature as well.
Other way would be to open the html in Word and use its feature to save as PDF. I’m assuming Word will open the html correctly, but I haven’t done that in a while.
Hi @CamiCat,
The @ClaytonM idea is very good. Normal conversion sometimes is having some styles issue. But when you do direct print as a PDF. It is good.
You can use Save As or Print. I think Print to PDF works well.
You can get there with alt+f+p TypeInto "[k(alt)]fp"
The only problem is Word might not format your html correctly, but you can try it.
I think opening it in a browser would work better. You can use Open Application or Start Process to open Chrome or iexplore with the html filename as the argument. Then, use the Print
Dim filePath As String = in_htmlFile
Dim url As String = “file:///” & System.Uri.EscapeUriString(filePath.Replace("", “/”))
Console.WriteLine(url)
'Set the chrome.exe file path
Dim chromePath As String = “C:\Program Files (x86)\Google\Chrome\Application\chrome.exe”
If Not File.Exists(chromePath) Then
Dim userFolder As String = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)
chromePath = userFolder+“\AppData\Local\Google\Chrome\Application\chrome.exe”
End If
If Not File.Exists(chromePath) Then
Throw New Exception(“Unable to locate Chrome.exe”)
End If
Console.WriteLine(“saving”)
Using p As New Process()
p.StartInfo.FileName = chromePath
p.StartInfo.Arguments = “–headless --disable-gpu " &
“–run-all-compositor-stages-before-draw --print-to-pdf=””" & in_pdfFilePath & “”" “”" & url & “”“”
p.Start()
p.WaitForExit()
End Using