HTML to PDF: "Operation is not valid due to the current state of the object"

We’ve received errors from a production system, when attempting to convert HTML to PDF, with the following error message…

Operation is not valid due to the current state of the object

I’ve tracked down the fault to a very specific style command (which I admit is very niche, and I can fully understand why Aspose.PDF doesn’t cope with it).

You can replicate the fault using the following HTML…

<!DOCTYPE html>
<html>
  <head></head>
  <body>
    <div style='color: rgba(0,0,0,var(--example-opacity));'>Some Text</div>
  </body>
</html>

Please note --example-opacity does NOT exist in the original HTML (or any external CSS). The content was entered by a user through an HTML editor (obviously pasted from some other source), and then that HTML was inserted into a template for printing.

The production system is using Aspose.PDF 23.2.0, but I’ve also confirmed the fault happens in latest 23.3.0.

Please let me know if you have any other questions.

Cheers,
Tom

@stonefish,

I was able to replicate the issue. I will create a ticket to see if the dev team decides to do something about it.

@stonefish
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFNET-54071

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Thanks Carlos.

This was a fault on a production system, that I had to manually amend data to get working again… so I do hope they decide it’s seriously enough to fix.