BoldDesk®Customer service software offering ticketing, live chat, and omnichannel support, starting at $49/mo. for 10 agents. Try it for free.
Hi,
I want to use the html to pdf community project and run against .net core6 and work on Mac and Windows. Hence the code is platform indepedant. The sample below reference the Windows package, so I would like to know how do I do this so the code is not windows pecific
https://github.com/SyncfusionExamples/html-to-pdf-csharp-examples/tree/master/ASP.NET%20Core
Hi gert,
Thank you for reaching out to Syncfusion support.
We can perform HTML to PDF conversion in .net core 6 on Mac and Windows by installing the nuget packages for Windows and Mac parallely in the same project as highlighted in the below screenshot.
We have attached our UG Documentation to perform HTML to PDF conversion and sample for your reference.
UG: https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/converting-html-to-pdf
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Html_to_Pdf1361747743
kindly try the above solution and let us know the result. If you need further assistance, kindly get back to us.
Perfect, that make a lot of sense. Thank you. This lead me to the next question. I am trying to use the html header and html footer option, with a supplied html body, but it would not render???
The component is throwing a weird exception? See sample code attached
Hi gert,
We have checked your issue on our end. We are able to reproduce the reported issue. We suspect that the reported issue may occur due to an excessively large header, leaving insufficient space for the body content on the PDF page.
We have two options to set the header and footer while converting the HTML to PDF document. Please refer to the details below.
Using the HtmlHeader & HtmlFooter:
We can add the header and footer by set the html string in this property. However, it is important to note that this property has certain limitations, such as its support only base64 strings for images and only allowing inline CSS styles.
Please refer the below documentation.
How to Insert a Page Number in the HTML Footer Using the Inline Style (syncfusion.com)
Using PdfHeader & PdfFooter:
We are converted the input html header to pdf document, after created the PdfPageTemplateElement and assign the element to PdfHeader and PdfFooter. It will preserve the Header and Footer in the same way as the input HTML/URL is displayed in Chromium-based web browsers such as Chrome and print preview. Our converter replicates this same behavior.
How to add PDF header and footer while converting HTML to PDF document (syncfusion.com)
We have attached the sample with usage of PdfHeader & PdfFooter for your reference.
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/HTML-Header-and-Footer249687792
Kindly try the above solution and let us know the result.
Regards,
Arumugam M
Hi,
thank you very much. I did not think about this approach. I will try a few more options on the spacing and sizing of the header and footer to get in more in proportion with each other etc.
Hi gert,
Thanks for your update. Please let us know if you need any further assistance on this.
Regards,
Arumugam M