So konvertieren Sie HTML mit Node.js über C++ in PDF

Übersicht

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 konvertieren Sie HTML in das PDF-Saveformat. It covers the following topics.

HTML-zu-PDF-Konvertierung in Node.js

Wie konvertiert man HTML in PDF? Mit der Aspose.Cells for Node.js via C++ Bibliothek können Sie HTML einfach programmatisch in PDF umwandeln, mit nur wenigen Codezeilen. Aspose.Cells for Node.js via C++ ist in der Lage, plattformübergreifende Anwendungen zu erstellen, die alle Excel-Dateien generieren, modifizieren, konvertieren, rendern und drucken können.

JavaScript HTML in PDF konvertieren

Das folgende JavaScript-Codebeispiel zeigt, wie man ein HTML-Dokument mit Aspose.Cells for Node.js via C++ in eine PDF umwandelt.

  1. Erstellen Sie eine Instanz der Klasse HtmlLoadOptions.
  2. Initialisieren Sie das Workbook Objekt.
  3. Speichern Sie das Ausgabedokument als PDF, indem Sie die Methode Workbook.save() aufrufen.
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");

Versuchen Sie, HTML online in PDF zu konvertieren

Aspose.Cells for Node.js via C++ presents you online free application „HTML in PDF“, where you may try to investigate the functionality and quality it works.