Can I export Html to PDf using PDFStreamWriter or PDFFormatProvider?
1 Answer, 1 is accepted
1
Dimitar
Telerik team
answered on 04 Nov 2021, 11:08 AM
Hello Miguel
You cannot directly convert the HTML. You need to use the WordsProcessing library to import the HTML and then convert it to PDF. Here is an example:
var htmlProvider = new HtmlFormatProvider();
var pdfPRovider = new PdfFormatProvider();
var doc = htmlProvider.Import(html_string);
File.WriteAllBytes(@"..\..\result.pdf", pdfPRovider.Export(doc));
I hope this helps. Should you have any other questions do not hesitate to ask.
Regards,
Dimitar
Progress Telerik
Remote troubleshooting is now easier with Telerik Fiddler Jam. Get the full context to end-users' issues in just three steps! Start your trial here - https://www.telerik.com/fiddler-jam.