How to Convert HTML to PDF with Node.js via C++
Overview
Aspose.Cells is a professional solution that allows you to generate PDF files from web pages and raw HTML code in your applications.
This article explains how to convert HTML to PDF. It covers the following topics.
HTML to PDF Conversion in Node.js
How to convert HTML to PDF? With Aspose.Cells for Node.js via C++ library, you can easily convert HTML to PDF programmatically with a few lines of code. Aspose.Cells for Node.js via C++ is capable of building cross-platform applications with the ability to generate, modify, convert, render and print all Excel files.
JavaScript Convert HTML to PDF
The following JavaScript code sample shows how to convert an HTML document to a PDF using Aspose.Cells for Node.js via C++.
- Create an instance of the HtmlLoadOptions class.
- Initialize Workbook object.
- Save output PDF document by calling Workbook.save() method.
const AsposeCells = require("aspose.cells.node");
const path = require("path");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
const filePath = path.join(dataDir, "sample.html");
// Loads the workbook which contains hidden external links
const options = new AsposeCells.HtmlLoadOptions(AsposeCells.LoadFormat.Html);
const book = new AsposeCells.Workbook(filePath, options);
book.save("out.pdf");
Try to convert HTML to PDF online
Aspose.Cells for Node.js via C++ presents you online free application “HTML to PDF”, where you may try to investigate the functionality and quality it works.