Error when converting html to pdf in .NET


#1

I am converting html file to pdf with aspose pdf v 19.8.0.0 for .NET.

Conversion of the attached html dies, but before that it consumes all the RAM on the server and takes a very long time.

I need this conversion to complete successfully without changing the html.

I am sending you an exemplary html, so that you can test it in your environment.

Problematic is the combination of table-layout: fixed and the table with no rows. But as said, removing the table-layout or removing the empty table or adding an empty row to the empty table is sadly not the option.

Please, help.
error.zip (460 Bytes)


#2

@natalial

We tested the scenario in our environment and noticed that API was throwing NullReferenceException while converting your HTML into PDF. We also tried by removing comment from CSS style in the file but did not get success. Would you please make sure to share a HTML file with which we can replicate the original issue that you are facing. We will again test the scenario in our environment and address it accordingly.


#3

Well, that is exactly the error that is bothering me.

If you try with

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <META http-equiv="Content-Type" content="text/html; charset=utf-16">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
    <title>Test</title>
    <style type="text/css"><!--
                                    table { table-layout: fixed; }
                             --></style>
  </head>
  <body>
    <div>
      <div>
        <table>
          <tr>
            <td>
              <table>
              </table>
            </td>
          </tr>
          <tr>
            <td>Hello world!</td>
          </tr>
        </table>
      </div>
    </div>
  </body>
</html>

OR

<html>
  <head>
    <META http-equiv="Content-Type" content="text/html; charset=utf-16">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
    <title>Test</title>
    <style type="text/css"><!--
                         table {  }
                    --></style>
  </head>
  <body>
    <div>
      <div>
        <table>
          <tr>
            <td>
              <table>
                <col width="100%">
                <col width="70px">
                <col width="34px">
              </table>
            </td>
          </tr>
          <tr>
            <td>Hello world!</td>
          </tr>
        </table>
      </div>
    </div>
  </body>
</html>

it totally works.


#4

@natalial

Thanks for sharing further details.

We have logged an issue as PDFNET-46810 in our issue tracking system for the sake for further investigation. We will look into details of it and keep you posted with the status of its correction. Please be patient and spare us little time.

We are sorry for the inconvenience.


#5

The issues you have found earlier (filed as PDFNET-46810) have been fixed in Aspose.PDF for .NET 19.9.


#6

Thank you very much!


#8

I confirm that the fix works as expected. Thank you very much!


#9

@natalial

Thanks for your feedback.

Please keep using our API and in case of any further assistance, please feel free to let us know.