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