Unable to Generate PDF from word

When trying to generate PDF from HTML file, below error is thrown.The stack trace is also lengthy and it is mostly garbled characters, but it at the end it looks like the error id from the Constructor.

Can you please help resolve this, below is the code snippet where error is thrown from

Blockquote
HtmlLoadOptions options = new HtmlLoadOptions();
options.HtmlMediaType = HtmlMediaType.Print;
Document pdfDocument = new Document(sDestinationPDFPath + “HtmlPage.html”, options);

Message: Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index\n\n\nStack Trace: at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)\r\n at #=zKqynjq4cWYvgKoI_g9WJmCHwBVkjXdD1eCk1Nm0=.#=z4rv$SbiBB3VS.get_Item(Int32 #=z8uXFBBQ=)\r\n at

…’

#=zswH$aVR6HIrP, Document #=z1P91RMrDGtKM, HtmlLoadOptions #=z67c0XNBOeacb)\r\n at Aspose.Pdf.Document.#=zLBoAUMU=(Stream #=z80UDQl4=, LoadOptions #=ztItDrhg=)\r\n at Aspose.Pdf.Document…ctor(String filename, LoadOptions options)\r\n at MoveFiles.PrintMultiple.GenerateConsolidatedDocument() in

@crazytechieboy

Would you please share your sample HTML in .zip format with us? We will test the scenario in our environment and address it accordingly.

I can’t share the html file due to security reasons. But below is little info it:

  • the html file has data for about 120 page when printed to word/pdf
  • size of html file is about 800 KB

Please let me know if i can in any other way

@crazytechieboy

We are afraid that we cannot comment further about the issue without replicating and investigating it in our environment. May be you can trim specific information from the HTML content and then share it with us. Please also note that we do not disclose your files with anyone and erase them from our system after investigating the issue.

Here is the sample HTML.

Sample HtmlPage.zip (130.4 KB)

@crazytechieboy

We were unable to notice any issues in our environment while testing the scenario with 22.9 version of the API. Please check the generated output attached here. Could you please try using the latest version of the API and let us know in case you still notice any issues.
output.pdf (638.1 KB)

A post was split to a new topic: We are getting error when trying to convert html to pdf