Dear Telerik Team,
We encounter an issue with export html data to pdf file using below code. For example,
using Telerik.Web.UI;
using OpenXmlSpreadsheet = DocumentFormat.OpenXml.Spreadsheet;
using Pdf = Telerik.Windows.Documents.Flow.FormatProviders.Pdf;
using te = Telerik.Windows.Documents.Flow.FormatProviders.Html;
using tm = Telerik.Windows.Documents.Flow.Model;
using tp = Telerik.Windows.Documents.Primitives;
using tt = Telerik.Windows.Documents.Spreadsheet.Theming;te.HtmlFormatProvider provider = new te.HtmlFormatProvider();
tm.RadFlowDocument document = provider.Import(HttpUtility.HtmlDecode(htmldata));
tt.ThemeFontScheme fs = new tt.ThemeFontScheme("Arial", "Helvetica", "sans-serif");
tt.DocumentTheme theme = new tt.DocumentTheme("PDF", document.Theme.ColorScheme, fs);
document.Theme = theme;
document.Sections[0].PageMargins = new tp.Padding(50, 25, 50, 25);
Pdf.PdfFormatProvider providerPdf = new Pdf.PdfFormatProvider();
byte[] fileBytes = providerPdf.Export(document);
"providerPdf.Export(document);" this line throws exception "An exception occurred during a WebClient request" whenever we include <img src="/image path/image.png" /> html tag.
Your support is appreciated.
Hi Pravin,
Can you provide the exact exception along with the call stack?
If you are using the Net Standard version you need to add a default ImagePropertiesResolver. Detailed information is available here: PdfProcessing - Images - Telerik Document Processing.
I am looking forward to your reply.
Regards,
Dimitar