Rendering Charts and Graphs in PDFs
IronPDF can render web pages containing charts, graphs, and other elements built with modern JavaScript technologies.
IronPDF supports WebGL, allowing it to process web canvas-built elements using the machine's hardware graphics capabilities.
IronPDF supports all third-party chart libraries, including:
- C3.js
- D3.js
- Highcharts
The setEnableJavaScript
method on the ChromePdfRenderOptions
object enables the developer to enable the processing of JavaScript referenced internally or externally within a web page. This property must be set to true to allow IronPDF to process the JavaScript needed to render the charts and graphics on a webpage.
The setRenderDelay
configures IronPDF to postpone its interpreting of a web page's JavaScript for a specified amount of time (in milliseconds) after it has loaded its DOM. This method is useful in ensuring that IronPDF's HTML-to-PDF converter captures content that appears on a web page seconds after a browser finishes loading it initially. This is particularly relevant for asynchronous JavaScript code that takes a long time to complete.
Refer to the JavaScript Charts to PDF Code Example for more details about additional methods available on the ChromePdfRenderOptions
class.
Render JavaScript Charts into PDF
- Add IronPDF to your Maven project:
- Use
ChromePdfRenderOptions
to enable JavaScript and configure delay/media type. - Render HTML (inline string, file, or URL) using
PdfDocument.renderHtmlAsPdf(...)
. - Save the output with
saveAs(...)
.
Learn how to enable JavaScript processing for dynamic charts in your PDFs!