Wie konvertiert man HTML mit 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 in PDF-Konvertierung in C++
Wie konvertiere ich HTML in PDF? Mit der Aspose.Cells for C++ Bibliothek können Sie HTML einfach programmatisch in PDF konvertieren, mit nur wenigen Codezeilen. Aspose.Cells for C++ ist in der Lage, plattformübergreifende Anwendungen zu erstellen, die in der Lage sind, alle Excel-Dateien zu generieren, zu modifizieren, zu konvertieren, anzuzeigen und zu drucken.
C++ HTML in PDF konvertieren
Das folgende C++-Codebeispiel zeigt, wie man ein HTML-Dokument mit Aspose.Cells for C++ in ein PDF umwandelt.
- Erstellen Sie eine Instanz der HtmlLoadOptions Klasse.
- Initialisieren Sie das Workbook Objekt.
- Speichern Sie das Ausgabe-PDF-Dokument, indem Sie die Methode Workbook.Save() aufrufen.
#include <iostream>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;
int main()
{
Aspose::Cells::Startup();
// Create HTML load options
HtmlLoadOptions options(LoadFormat::Html);
// Load the HTML file into a workbook
U16String inputFilePath(u"sample.html");
Workbook book(inputFilePath, options);
// Save the workbook as PDF
U16String outputFilePath(u"out.pdf");
book.Save(outputFilePath);
std::cout << "HTML file converted to PDF successfully!" << std::endl;
Aspose::Cells::Cleanup();
}
Versuchen Sie, HTML online in PDF zu konvertieren
Aspose.Cells for C++ presents you with an online free application „HTML in PDF“, where you may try to investigate the functionality and quality it works.