HTML to PDF Using CefSharp [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

This question does not appear to be about programming within the scope defined in the help center. Closed 11 months ago .

I´m looking for the best way to convert HTML to PDF using CefSharp, I think this library is a good option because I can directly use the Chromium Html Render but I don't know how to start.

8,733 95 95 gold badges 59 59 silver badges 93 93 bronze badges asked May 11, 2020 at 4:08 13 2 2 bronze badges

1 Answer 1

You can leverage the builtin method to save whole html page as pdf use the code mentioned below for your reference, Please check if it helps.

var success = await webBrowserObject.PrintToPdfAsync("filename.pdf", new PdfPrintSettings < MarginType = CefPdfPrintMarginType.Custom, MarginBottom = 10, MarginTop = 0, MarginLeft = 20, MarginRight = 10, PageWidth = 210000, PageHeight = 297000 >); 

You can use open file dialog box to take file name from user