Search code examples
javascriptasp.netaspose

Aspose - HTML to PDF - Input Values missing


We're doing some Aspose HTML to PDF conversions on a page, but are noticing that all our input values are not being rendered in the pdf file.

The method we are trying to use is to have some javascript return the outerHTML for the entire DOM which we use to send back to Aspose.

The problem with this approach is that, upon inspecting the DOM string returned, none of the input values are captured.

enter image description here

This probably explains why none of the input on the screen is being rendered in the HTML to PDF conversion.

We've also tried the standard snippets of code that are in this answer HTML to PDF conversion using Aspose

But the problem we're running into is that the page has to first fire off some JavaScript and Ajax calls to populate the input values first. (Also, this is an ASP web forms project, and the javascript is being invoked server side with WebControl.EvalScript('jsscript()'). So I do not believe these methods will work.

Is there a way for us to obtain the complete DOM (with the input values and state of checkboxes, etc) from Javascript? Or are there alternative ways of doing this?


Solution

  • After digging deeper I was able to find a question similar to this one which has the correct answer.

    reading innerHTML of HTML form with VALUE attribute (& its value) of INPUT tags

    The solution here is to explicitly set the value attributes on the DOM for each of the input elements. After we did this the conversion was successful and included text inside each of the input fields.