I'm working on a Unity3D based application and need to generate PDFs from HTML code. I tried other libraries but they're either super slow, outdated, or crazy expensive for my purposes. Because of that, I'm considering using Chrome's PrintToPDF feature which is built right in.
For testing, the following code works to generate a PDF of Google's homepage (or any site), but I need to convert an HTML string to a PDF.
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
process.StartInfo.FileName = @"C:\Program Files\Google\Chrome\Application\chrome.exe";
string arguments = @"--headless --print-to-pdf=""C:\Users\userName\desktop\myReport.pdf"" https://google.com";
process.StartInfo.Arguments = arguments;
process.Start();
Is it possible to input either a string with the HTML code or a locally-stored standalone HTML file to convert to PDF using this method?
Thanks!