Cómo convertir HTML a PDF con C++
Visión general
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 convertir HTML a PDF. It covers the following topics.
Conversión de HTML a PDF en C++
¿Cómo convertir HTML a PDF? Con la biblioteca Aspose.Cells for C++, puedes convertir fácilmente HTML a PDF automáticamente con unas pocas líneas de código. Aspose.Cells for C++ es capaz de crear aplicaciones multiplataforma con la capacidad de generar, modificar, convertir, renderizar e imprimir todos los archivos de Excel.
Convertir HTML a PDF en C++
El siguiente ejemplo en C++ muestra cómo convertir un documento HTML a PDF usando Aspose.Cells for C++.
- Crear una instancia de la clase HtmlLoadOptions.
- Inicializar el objeto Workbook.
- Guarda el documento PDF de salida llamando al método Workbook.Save().
#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();
}
Intenta convertir HTML a PDF en línea
Aspose.Cells for C++ presents you with an online free application “HTML a PDF”, where you may try to investigate the functionality and quality it works.