Having issue with HTML text reading to generate the PDF

Hello Team,


We are creating a PDF using HTML text but the html text is reading in the generated PDF as normal text. It is not creating the PDF with the HTML text like bullet points, link available on the HTML text.


we are using the below code for the same:

//set the font

PdfFont font = new PdfStandardFont(PdfFontFamily.TimesRoman, 14, PdfFontStyle.Regular);

//html text

string htmlText = "

<html><head>

                                <style type="text/css"> body,p,h1,span {margin:0px;padding:0px;color:black;font-family: 'Roboto', sans-serif;font-size:40px;}a { color: #00ABE7; }img{display: inline; height: auto; max-width: 100%;} word-wrap: break-word;</style>

                                </head><body><p><strong>ZF Jobs</strong></p><p> Looking to be part of the automotive future? Search our current vacancies to find the opportunity that is best for you. </p><ul><li><a rel='nofollow' href="https://jobs.zf.com/" >Vacancies </a></li><li><a rel='nofollow' href="https://jobs.zf.com/go/Autonomous-Driving/4224501/" >Jobs in the field of autonomous driving Jobs </a><a rel='nofollow' href="https://jobs.zf.com/go/E-Mobility/4224601/" >in the field of E-Mobility</a></li></ul><p>fdghghgyhh<br>cvbvgvgbb</p><ul><li>ZF is a globally leading technology company that is creating the mobility solutions of tomorrow. We develop and design products to achieve the ultimate goal of zero emissions and zero accidents. Our innovative</li><li>In a world that is rapidly changing, it is critical that we respond fast and flexibly in order to continue to shape the future trends of mobility.</li><li>As a globally attractive employer, ZF has many diverse international work opportunities to offer its employees. Our financial independence allows us to invest wisely in research and development now and in the</li></ul></body></html> "

//Render Html text

PdfHTMLTextElement richTextElement = new(htmlText, font, PdfBrushes.Black);

Could you please help us to resolve the issue.


Thanks

Vaibhav Agarwal


1 Reply

SL Sowmiya Loganathan Syncfusion Team November 3, 2023 02:37 PM UTC

We have analyzed your query and currently we do support only basic tags. Please refer the below for your reference,



UG documentation link: https://help.syncfusion.com/file-formats/pdf/working-with-text#adding-a-html-styled-text


However, we can achieve your requirement by converting HTML to PDF document using HtmlToPdfConverter class. Please refer the below UG documentation for more details,

https://help.syncfusion.com/file-formats/pdf/converting-html-to-pdf


Loader.
Up arrow icon