How to Convert Excel Chart to PDF using Node.js

This short guide describes how to convert Excel chart to PDF using Node.js. It has all the details to configure the IDE, a list of programming steps, and a runnable sample code to convert Excel graph to PDF using Node.js. You will also learn to render the chart at the specified position on the PDF.

Steps to Convert Excel Chart to PDF using Node.js

  1. Set the IDE to use Aspose.Cells for Node.js via Java to render charts to PDF
  2. Load the source Excel file using the Workbook class object having a chart in it
  3. Access the target sheet with the chart
  4. Get a reference to the target chart for the conversion to PDF
  5. Call the toPdf() method in the Chart class to change the chart to a PDF file

These steps define how to convert Excel graph to PDF using Node.js. Initiate the process by loading the source Excel file, accessing the target worksheet and getting the reference to the desired chart from the collection of charts in the sheet. The Chart class contains the toPdf() method that transforms the chart to PDF at a desired position.

Code to Export Excel Chart to PDF using Node.js

This sample code demonstrates the conversion of Excel chart to PDF using Node.js. Every sheet in the workbook has a collection of charts that can access the target chart using the zero-based index. The toPdf() method in the Chart class takes the output PDF file name, the x and y pixels and layout alignment such as RIGHT and Bottom used in this code sample.

This article has guided us to change the Excel chart to PDF using Node.js. If you want to create a chart, refer to the article on how to create chart in Excel using Nodejs.

 English