クラシックなテキストヘッダー & フッターを追加

HTMLコンテンツをレンダリングする際に、PDFドキュメントにテキストヘッダーとフッターを追加する方法を学びます。

テキストヘッダーとフッターを含めるには、レンダリングオプションオブジェクトで指定する必要があります。 Define the header content with a divider line, centered text displaying the HTML title, font settings, and font size. Similarly, define the footer with the textFooter property. You can utilize fields like {page}, {total-pages}, {url}, {date}, {time}, {html-title}, and {pdf-title} to personalize the content.

ヘッダーとフッターが適切に収まるようにマージンをカスタマイズします。

Utilize the PdfDocument.fromHtml method to convert your HTML content into a PDF. Pass the renderOptions object as an option.

HTMLからPDFを作成する詳細なドキュメントは、IronPDF Documentationを訪問してください。

ヘッダーとフッターを含む最終的なPDFドキュメントは、"header_footer.pdf"という名前で保存されます。

ヘッダーとフッターのサンプルコードを GitHub で調べる

準備はできましたか?
バージョン: 2026.3 リリース
Still Scrolling Icon

まだスクロールしていますか?

すぐに証拠が欲しいですか?
サンプルを実行するHTML が PDF に変換されるのを確認します。