This precise topic will teach you how to convert XLSX to PDF having restricted permissions in Node.js. You can apply different permissions and restrictions before exporting an XLSX file to PDF having restricted permissions in Node.js. Ultimately the loaded Excel workbook is saved as a PDF file and can be opened in any PDF viewer or browser with the specified permissions.
Steps to Convert XLSX to PDF Having Restricted Permissions in Node.js
- Configure the IDE to use Aspose.Cells for Node.js via Java in your application to convert an XLSX to a PDF
- Load the source XLSX file that is to be converted to PDF using an instance of the Workbook class
- Initialize the PdfSaveOptions and PdfSecurityOptions classes instances to set the security options
- Set the restrictions on copying/extracting workbook content and printing the PDF in Node.js
- Save the workbook as a PDF file having restricted permissions on the disk
In the above step-by-step process, we will first access the XLSX file from the disk that is to be exported to PDF and then set restrictions to the PDF exported from the XLSX file using the instance of the PdfSecurityOptions class, like a restriction to print the PDF or restriction to copy or extract text from PDF. Once the desired restrictions are set, the loaded workbook is saved as a PDF file having applied restrictions on the disk.
Code to Convert XLSX File to PDF Having Restricted Permissions in Node.js
In the above example, we have used the PdfSaveOptions class instance for setting the restrictions on PDF converted from an XLSX. The class takes PdfSecurityOptions parameter that exposes the options to apply the restrictions. After applying the required restrictions, the workbook is exported as a PDF file using the PdfSaveOptions object as a parameter inside the save() method.
We have learned to convert the XLSX file to PDF. If you are interested to learn about saving an Excel file as an HTML, refer to the article on how to convert Excel to HTML in Node.js.