iText 7 pdfHTML
pdfHTMLはHTMLからPDFへのコンバーターであり、HTMLやCSSをPDF文書へと簡単に変換します。iText 7のアドオンとしてpdfHTMLを使用してすぐに使えるソリューションを実現したり、単独でも使用することもできます。
How it works
With just few lines of code you can use pdfHTML to get great results in no time. This code sample demonstrates how to use pdfHTML to convert a source HTML file (input.html) into a PDF (output.pdf). Click the button in the code window below to switch between the Java and C# examples.
1
2
3
4
5
6
7
8
9
public static void main() throws IOException {
// IO
File htmlSource = new File("input.html");
File pdfDest = new File("output.pdf");
// pdfHTML specific code
ConverterProperties converterProperties = new ConverterProperties();
HtmlConverter.convertToPdf(new FileInputStream(htmlSource),
new FileOutputStream(pdfDest), converterProperties);
}
1
2
3
4
5
6
7
8
9
static void Main(string[] args)
{
using (FileStream htmlSource = File.Open("input.html", FileMode.Open))
using (FileStream pdfDest = File.Open("output.pdf", FileMode.OpenOrCreate))
{
ConverterProperties converterProperties = new ConverterProperties();
HtmlConverter.ConvertToPdf(htmlSource, pdfDest, converterProperties);
}
}
Below you can see an example of pdfHTML in action; using it to convert a web page into a PDF.
The original web page
After the pdfHTML conversion
Resources
Here you will find the needed resources to install and use pdfHTML.
Java
Other resources
iText 7 pdfHTMLを使う理由
HTMLの構造情報を再利用すれば、PDF/A、PDF/UA、タグ付きPDFを簡単に作成できます。
HTMLツールと統合しやすい
HTMLとCSSを利用して文書のレイアウトとスタイルを設定すれば、既存のHTMLとCSSスキルを活用してPDFを作成できます。このアドオンはHTMLのツールと簡単に統合できます。
革新的で、カスタマイズされたオプションにより、HTMLからPDFへの変換が可能です。
HTML要素は、HTML5とCSS3に基づいたiText要素へすでにマップされています。カスタマイズするには、独自のハンドラをpdfHTMLフレームワークに追加するだけです。
構造化PDF文書の作成
HTMLの構造情報と意味情報を再利用して、PDF/A、PDF/UA、タグ付きPDFを作成し、標準に準拠したPDF文書を作成します。
iText 7 pdfHTMLのコア機能
pdfHTMLでは便利なAPIを提供することで、HTMLファイルをPDFファイルやiText要素のリストに直接変換できるので、HTML要素を解析して挿入する方法を細かく制御できます。
HTMLの柔軟性をPDFで活用
- 静的HTML5とCSS3をPDFへ変換
- 使いやすいAPIにより、変換はカスタマイズ可能で、動的かつシンプル。
変換オプション
- 文書全体をPDFへ直接変換。
- HTMLスニペットを「iTextの構成要素」に変換(HTMLリッチテキスト段落からiTextの段落オブジェクトへなど)。
PDF標準に準拠したPDFを作成
PDF/A、PDF/UA、タグ付きPDFが作成できます。
カスタマイズ可能
- バーコードなどの動的コンテンツをPDFに追加。
- コンバータープロパティとタグのカスタム処理を活用して、変換を微調整。
iText DITO, an alternative to pdfHTML
If you need to create templates for PDFs, and want to save time when creating and editing them without writing a single line of code, then why not try iText DITO, our low-code PDF generator.
