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

Free Support Forum - aspose.com

Error when using some html tags in text

The following attached code generates error "ol is null" when saving the pdf file.

For more info, see the attached code.

Thanks in advance.

Hello Radu,

Thanks for using our products.

In order to convert the InLineHTML text into PDF format, the HTML tags must be properly defined (proper starting and ending tags). Please try using the following updated code snippet in order to gerneate the PDF document. I have tested the scenario using Aspose.Pdf for .NET 4.3.0 and I am able to generate the output file. The resultant PDF is also in attachment, please take a look.

[C#]

Pdf pdf1 = new Pdf();
Section sec1 = pdf1.Sections.Add();

string st = "" + "

    " +
    "
  1. " +
    "

    test arial 3
  2. " +
    "
  3. test arial 4
  4. " +
    "
  5. test courier new 3
  6. " +
    "
  7. test courier new 5
  8. " +
    "
  9. verdana 5
  10. " +"
  11. verdana 3 "+
    "
  12. " +
    "
"+
"" +
"

" +
"

";

Text ts = new Text(st);
ts.IsHtmlTagSupported = true;
sec1.Paragraphs.Add(ts);
pdf1.Save("d:/pdftest/HTMLtoPSD_TestHtml.pdf");

In case it does not resolve your problem or you have any further query, please feel free to contact. We apologize for your inconvenience.

Hi, we cannot modify the html because it is dynamically generated by the winforms webbrowser control. We’ve done a couple of aditional tests with other html to pdf parsers on the same code, and text gets parsed correctly, so it may be a deeper issue with this html to pdf parser.

Hello Radu,

Thanks for using our products.

As per the product design, In order to transform the HTML content into PDF format, the HTML contents must be in proper format (proper starting and ending tags). So, you need to programmatically parse the HTML contents and correct them before they are used by Aspose.Pdf for .NET to be transformed into PDF format. We apologize for your inconvenience.