RadPdfProcessing - Export Html to PDF

1 Answer 1851 Views
PdfProcessing
This question is locked. New answers and comments are not allowed.
Miguel
Top achievements
Rank 1
Miguel asked on 03 Nov 2021, 10:08 AM
Can I export Html to PDf using PDFStreamWriter or PDFFormatProvider?

1 Answer, 1 is accepted

Sort by
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.
Tags
PdfProcessing
Asked by
Miguel
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or