here is my code
- Code: Select all
public byte[] ExportAsPdf(string htmlCode, string reportContent)
{
MemoryStream output = new MemoryStream();
PdfDocument doc = new PdfDocument();
try
{
HtmlString htmlString2 = new HtmlString(htmlCode);
string fullHtmlCode = htmlString2.ToHtmlString();
fullHtmlCode = fullHtmlCode.Replace("#ReportContent", reportContent);
PdfMargins margins = new PdfMargins(60, 60, 60, 60);
//create a header template with content and apply it to page template
doc.Template.Top = CreateHeaderTemplate(doc, margins);
//create a footer template with content and apply it to page template
doc.Template.Bottom = CreateFooterTemplate(doc, margins);
PdfPageSettings setting = new PdfPageSettings();
setting.Size = new SizeF(1000, 1000);
setting.Margins = new Spire.Pdf.Graphics.PdfMargins(20);
PdfHtmlLayoutFormat htmlLayoutFormat = new PdfHtmlLayoutFormat();
htmlLayoutFormat.IsWaiting = true;
Thread thread = new Thread(() =>
{
doc.LoadFromHTML(fullHtmlCode, true, setting, htmlLayoutFormat);
});
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
//Save pdf file.
}
catch(Exception ex)
{
}
doc.SaveToStream(output);
return output.ToArray();
}
and i need this style to be rendered well
- Code: Select all
table thead tr th:first-child {
border-radius: 0 10px 0 0;
}
is this available to read style for the element in this way ?
Thanks