C++を用いたHTMLからPDFへの変換方法
概要
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 HTMLをPDFに変換する. It covers the following topics.
C++におけるHTMLからPDFへの変換
HTMLをPDFに変換する方法: Aspose.Cells for C++ライブラリを使えば、数行のコードでHTMLをPDFに簡単に変換できます。Aspose.Cells for C++は、クロスプラットフォームアプリケーションの構築や、すべてのExcelファイルの生成・修正・変換・レンダリング・印刷を可能にします。
C++でHTMLをPDFに変換
以下のC++コード例は、Aspose.Cells for C++を使用してHTMLドキュメントをPDFに変換する方法を示しています。
- HtmlLoadOptionsクラスのインスタンスを作成します。
- Workbookオブジェクトを初期化します。
- Workbook.Save() メソッドを呼び出して出力PDFドキュメントを保存します。
#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();
}
オンラインでHTMLをPDFに変換してみてください
Aspose.Cells for C++ presents you with an online free application 「HTMLをPDFに」, where you may try to investigate the functionality and quality it works.