JavaScript in HTML To PDF
Any JavaScript code within the HTML will be executed during the rendering process, whether it's from an HTML string, file, or URL to a PDF document.
To enable JavaScript execution, set the enableJavaScript
property to true. In some cases, such as when loading charts and graphs with JavaScript, you may also need to set a waitFor
property. This ensures that there is sufficient time for the JavaScript code to execute properly.
For more detailed instructions on enabling JavaScript in IronPDF, visit the JavaScript Code Examples page.
Example of Enabling JavaScript in IronPDF
Here is a concise example of how you can enable JavaScript execution in IronPDF:
- EnableJavaScript: This ensures that JavaScript within your HTML content is executed, which is essential for rendering dynamic content such as charts and graphs.
- RenderDelay: The
RenderDelay
option lets you specify a wait time (in milliseconds) to allow the JavaScript to fully execute before the page is rendered as a PDF. This is particularly useful when the JavaScript involves asynchronous operations or animations.
Additionally, check out the JavaScript Code Examples page for further examples and detailed information on handling different types of JavaScript within IronPDF.
Explore our detailed JavaScript to PDF conversion examples and enhance your IronPDF skills today!