Table-cell error converting HTML to PDF

I’m seeing the following error when trying to convert a user’s HTML file to PDF. It prints fine from Windows

ERROR: A table-cell is spanning more rows than available in its parent element.

I’m told that there is nothing amiss with the HTML file provided for testing.

Can anyone advise on what the issue is and how it may be resolved?

Thanks

@funassettc,

Thanks for contacting support.

I have observed your comments. Can you please share source file along with sample code so that we may further investigate to help you out.

Hello,
4 years later, I discover the same error message (and we use Aspose):
eb4c10fd97894e10dc2e3b0e6253afbc.png (143,5 Ko)

Would it be possible to have your help on this please?

Many thanks

@cdubien

Can you please share the information requested above so that we can further proceed accordingly.

Hello @asad.ali, here attached the .htm file into this .zip which have this issue :

MF-00065993.zip (10,7 Ko)

Many thanks for your help !

@cdubien

We tested using 24.3 version in our environment and could not see any error. Attached is the code snippet and generated file for your kind reference.

string html = File.ReadAllText(dataDir + "MF-00065993_0-2024-03-20 09 21 19.htm");

var byteArray = Encoding.UTF8.GetBytes(html);
using var inStream = new MemoryStream(byteArray);

var options = new HtmlLoadOptions
{
    // set Print or Screen mode
    HtmlMediaType = HtmlMediaType.Print,
    IsEmbedFonts = true,
    IsRenderToSinglePage = true
};

using var document = new Document(inStream, options);

document.Save(dataDir + "tst.pdf");

tst.pdf (548.8 KB)

Hello,
Unfortunately, regarding his issue on our side, it seems the .htm cannot be rendered but sometimes it’s possible. Could it be related to a specific version of Aspose? We don’t have Aspose 24.3, but 20.7. What can we check to move forward on this?

Many thanks,

Best regards,
Christophe

@cdubien

Yes, it can be related to the older version. You can obtain a 30-days temporary license in order to evaluate 24.3 version of the API and once you are satisfied that issue is no longer happening, you can upgrade your license.

Hello Asad,

Unfortunately, the product we use with Aspose, Documentum Content Transformation Services is not yet compatible with Aspose 23.4.
The question is, regarding the issue, it could be a 100% issue related to Aspose? And if it is, did you had this issue before? There is a workaround?

Many thanks,

Best regards,
Christophe

@cdubien

Every issue can be one of its own kind because PDF format is so dynamic. Even two identical document can differ from one another in terms of their structure. Therefore, we cannot say for sure if we have resolved similar issue before. However, it is evident that the latest version is not creating the issue and we can only comment further or continue our investigation if issue is present in the latest version which is not a case.

We are afraid that we cannot offer any workaround and only option we can give you is to upgrade to the latest version. Please feel free to let us know in case you need further information.

Hello Asad, would it be possible to share it the tst.pdf file? It seems it’s indicated as private but a colleague from Eng would like to check it please.

The code you shared is in .NET, can you please share this code in Java?

Many thanks !

@cdubien

Here is the equivalent code for Java:

import com.aspose.pdf.Document;
import com.aspose.pdf.HtmlLoadOptions;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;

public class HtmlToPdfConversion {
    public static void main(String[] args) {
        String dataDir = "your_data_directory/";

        try {
            String html = new String(Files.readAllBytes(Paths.get(dataDir + "MF-00065993_0-2024-03-20 09 21 19.htm")));

            byte[] byteArray = html.getBytes("UTF-8");
            ByteArrayInputStream inStream = new ByteArrayInputStream(byteArray);

            HtmlLoadOptions options = new HtmlLoadOptions();
            options.setHtmlMediaType(HtmlMediaType.Print);
            options.setEmbedFonts(true);
            options.setRenderToSinglePage(true);

            Document document = new Document(inStream, options);

            document.save(dataDir + "tst.pdf");
        } catch (Exception ex) {
            System.out.println(ex.getMessage());
        }
    }
}

The file link that you requested is here.