We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

HTML in PDF text rendering problem

Hello,

I am having problems getting Aspose.Pdf.Generator.Pdf to recognise

HTML tags. For example:


A


A


A


A


A




This HTML renders A A A A A and does not recognise the paragraph tags.

Has anyone had similar issues rendering HTML correctly?

Best regards
Iain

Hi Iain,


Thanks for using our products.

I have tested the scenario using Aspose.Pdf for .NET 8.0.0 with the following HTML and I am unable to notice any issue. Can you please try using the latest release version and in case the problem still persists, please share some details regarding your working environment.

[C#]

// Instantiate an object PDF class<o:p></o:p>

Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();

// add the section to PDF document sections collection

Aspose.Pdf.Generator.Section section = pdf.Sections.Add();

// Read the contents of HTML file into StreamReader object

StreamReader r = File.OpenText(@"c:/pdftest/sample.html");

//Create text paragraphs containing HTML text

Aspose.Pdf.Generator.Text text2 = new Aspose.Pdf.Generator.Text(section, r.ReadToEnd());

// enable the property to display HTML contents within their own formatting

text2.IsHtmlTagSupported = true;

//Add the text paragraphs containing HTML text to the section

section.Paragraphs.Add(text2);

//Save the pdf document

pdf.Save(“C:/pdftest/HTML2pdf.pdf”);



[HTML]

<html><o:p></o:p>

<body>

<html>

<tr>

<td colspan="8" style="border-right: 1px; text-align: left">

<p>A</p>

<p>A</p>

<p>A</p>

<p>A</p>

<p>A</p>

</td>

</tr>

<html>

</body>

</html>

Hello,

I am restricted to version 6.3.0.0, and am unable to upgrade at this point. Can you verify the function with this version?

Best regards
Iain

Hi Iain,


I have tried converting the HTML file to PDF format using Aspose.Pdf for .NET 6.3.0 and as per my observations, I am getting NullReferenceException exception. Furthermore, if the issue persists in 6.3.0, I am afraid we cannot resolve the problem in older release versions. For testing purposes, you may try using the latest release version in trial mode. And once you are satisfied with the latest release, you may consider upgrading your license subscription.

We are sorry for this inconvenience.


PS, I have tried using the same code snippet and HTML content as specified over 470572.

Hello Nayer,

Is there an opportunity for a patch to resolve this specific issue? At this point, we are unable to reformat / regression test all of our production code; I note our HTML rendering has been changed significantly by v. 8

Best regards
Iain

Hi Lain,


Thanks for your
inquiry. I’m afraid we can’t provide any fixes or patches for old versions of
Aspose.Pdf as we maintain a single code base. All fixes and new features are always added into new versions
of our products. So, we strongly recommend you please use the latest
official release of Aspose.Pdf for .NET to get a fix of reported issue. Furthermore, please feel free to ask any question or concern in migrating to latest version we will be glad to extend our support.<o:p></o:p>


Sorry for the inconvenience faced.


Best Regards,