Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
September 27, 2021 05:28 am GMT

HTMLtoPdf - Converts HTML content to PDF using chrome executable

Note : Requires Chrome executable

Nuget Link - https://www.nuget.org/packages/Sats.HTMLtoPdf

Github link - https://github.com/satsvelke/HTMLtoPdf

Usage

           var url = @"d:\Vaccination.html";          var chromePath = @"C:\Program Files\Google\Chrome\Application\chrome.exe";          // returns byte array of file           var pdf = new ChromeOptions().AddOptions(b =>                                      {                                          b.Headless();                                          b.DisableGPU();                                          b.WithoutHeader();                                      }).Pdf(new ChromeDetails() { ChromePath = chromePath, HtmlPath = url });           File.WriteAllBytes(@"d:\print.pdf", pdf);  

Original Link: https://dev.to/satsvelke/htmltopdf-converts-html-content-to-pdf-using-chrome-executable-3lmf

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To