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

Free Support Forum - aspose.com

Convert HTML File with Checkboxes to PDF using C# Code of Aspose.Words for .NET API

sample.zip (2.5 KB)
Hi,
I have attached a sample html. We are using Aspose.Word 17.2.
When we try to convert this html to pdf, we will get following error. Is there something wrong with checkbox?

Aspose.Words.FileCorruptedException: The document appears to be corrupted and cannot be loaded. —> System.ArgumentException: The reference node is not a child of this node.
at Aspose.Words.CompositeNode.(Node , Node , Boolean )
at Aspose.Words.CompositeNode.InsertBefore(Node newChild, Node refChild)
at Aspose.Words.DocumentBuilder.(Node )
at Aspose.Words.DocumentBuilder.InsertCheckBox(String name, Boolean defaultValue, Boolean checkedValue, Int32 size)
at Aspose.Words.DocumentBuilder.InsertCheckBox(String name, Boolean checkedValue, Int32 size)
at .(? )
at .(? , Boolean , ? )
at .(? , Boolean )
at .(? )
at .(? )
at .(? )
at .(? )
at .(? )
at .(? )
at .(? )
at .(? )
at .(? )
at .(? )
at .(? )
at .(? )
at .(Stream , Encoding , DocumentBuilder )
at .(Stream , Encoding , Document )
at Aspose.Words.Document.(Stream , LoadOptions )
— End of inner exception stack trace —
at Aspose.Words.Document.(Stream , LoadOptions )
at Aspose.Words.Document.(Stream , LoadOptions )
at Aspose.Words.Document…ctor(Stream stream, LoadOptions loadOptions)

@thomaschen0224,

After an initial test with the licensed latest (20.9) version of Aspose.Words for .NET, we were unable to reproduce this issue on our end. Please see the following output PDF document generated on our end:

C# Code:

Document doc = new Document("C:\\sample\\e2d1de0b-7349-4a54-9059-371daba0cb0c.html");            
doc.Save("C:\\sample\\output.pdf");

So, we suggest you to please upgrade to the latest version of Aspose.Words.

Thank you. I tested 20.9. 20.9 is fine. I will look into upgrade.