文書をPDFとして保存する方法
C# で PDF ファイルを操作するのは、開発者にとって難しい場合があります。 これらのファイルのコンテンツを作成するときに考慮すべき要素は多数ありますが、異なる形式のコンテンツを PDF に変換するときにはさらに多くの要素を考慮する必要があります。 自動化は現在、ソフトウェア開発プロセスにおいて非常に重要です。 これらの課題は、PDF ドキュメントの読み取り、書き込み、作成、変更、および属性の編集や他の形式からの変換を支援するように設計されたライブラリの開発によって解決されました。
このブログ記事では、 .NETと.NET Coreの 2 つの PDF ライブラリを比較します。
- IronPDFライブラリ
- Apitron PDF Kit
IronPDFと Apitron PDF Kit は、 .NETおよび.NET Core用の PDF 操作機能を提供するライブラリです。 これらはドキュメントフィールドの変換および操作タスクに使用できます。 ブックマークの作成も可能です。 次のステップは、どの C# PDF .NETライブラリが.NETプロジェクトに最適かを決定することです。 この記事の比較が、これら2つのPDFライブラリの選択を手助けします。
まず、2 つのライブラリが提供するものを確認し、次に比較に移ります。
Apitron PDF Kitライブラリとその機能
Apitron PDF Kit は、さまざまな方法で PDF ファイルを操作または変換できる.NETコンポーネントです。 画像、図面、テキストを追加したり、文書に署名したり、その他さまざまなことができます。 既存のコンテンツの編集も可能です。 Apitron PDF Kit .NETコンポーネントは、複数のプラットフォームでモバイル、デスクトップ、ウェブ、Windows、およびクラウドアプリケーションを作成するために使用できます。
このPDF SDKを使用すると、次のことができます:
- グラフィック(テキスト、画像、図面)の抽出、変更、追加
- PDFドキュメントの分割または結合
- パスワード保護されたPDFフォームを作成または入力、FDFサポート
- オプションのコンテンツ グループ (OCG) を使用して多層 PDF ドキュメントを作成します。
- ドキュメントにフィールドを追加または削除する
- 右から左または双方向テキストを使用してページコンテンツを作成
- ドキュメント内のリソースを検査 - 定義されたフォント、埋め込まれたファイル
- PDFドキュメントへのデジタル署名および既存の署名の検証
IronPDFの主な機能
開発者、特に C# プログラマーはIronPDF .NETライブラリを高く評価するでしょう。 このツールを使用すると、 .NET Core PDF 処理アプリケーションを簡単に構築できます。
IronPDF は.NET Chromium エンジンを使用して、HTML ページ (コードまたは URL 形式) を PDF ファイルに変換します。 ナビゲーション オブジェクトを配置したり、HTML から PDF を設計したりするために複雑な API を使用する必要はありません。 HTML、ASPX、JS、CSS、画像を含む標準のウェブドキュメントをIronPDFはサポートしています。
IronPDFは、HTML5、CSS、JS、画像を使用して作成できます。 PDFは簡単に編集、スタンプ、ヘッダーおよびフッターの追加が可能です。 また、PDF テキストの読み取りとグラフィックの抽出も簡単になります。
IronPDFの際立った機能には次のようなものがあります:
- HTML4/5、CSS、およびJavaScriptを使用したPDFドキュメントの作成
- カスタムネットワークログイン認証情報、ユーザーエージェント、プロキシ、クッキー、HTTPヘッダ、およびフォーム変数を使用してURLを読み込む(HTMLログインフォームの背後にログインを可能にします)
- PDFフォームフィールドの読み取りと入力
- PDFからのテキストとグラフィックの抽出
- PDFページを新しいHTMLコンテンツで更新
- テキストベースまたはHTMLベースのヘッダーとフッターの作成
- PDFドキュメントコンテンツの結合および分割
- ASP.NETウェブフォームを印刷可能なPDFに変換
- Adobe Acrobatソフトウェア無しでPDFファイルを印刷
IronPDF は、以下を含む C# と互換性のあるほぼすべてのオペレーティング システムおよびフレームワークで利用できます。
- .NET Core 2.1, 3.0, 3.1, .NET 6 & 5
- ユニバーサル互換性のため for .NET Standard 2.0準拠
- Azure, AWS, Docker, Linux, Windows
この記事の残りの部分は以下の通りです:
- IronPDFのインストール
- Apitron PDF Kitのインストール
- PDFドキュメントの作成
- PDFにヘッダーとフッターを作成
- PDFにデジタル署名を付ける
- 価格とライセンス
1. IronPDFのインストール
IronPDFライブラリをダウンロードしてインストールする方法は4つあります。 以下のような方法です:
- NuGetパッケージマネージャーを使用
- 開発者コマンドプロンプト
- NuGetパッケージを直接ダウンロード
- IronPDF .DLLライブラリをダウンロード
1.1. NuGetパッケージマネージャーを使用
IronPDFをインストールするには、ソリューションエクスプローラーのプロジェクトを右クリックするだけです。 これにより、NuGetパッケージマネージャーが開きます。

ソリューションエクスプローラを使用したNuGetパッケージマネージャへのアクセス
選択後、下のスクリーンショットに示すようにIronPDFパッケージを探してインストールします。

NuGetパッケージマネージャを使用したIronPDFライブラリのインストール
1.2. 開発者コマンドプロンプトの使用
また、開発者コマンドプロンプトを使用してIronPDFをインストールすることもできます。
- 開発者コマンドプロンプト を開きます。通常、Visual Studioフォルダーの下にあります。
- 次のコマンドを入力:
- Enterキーを押します
- これにより、パッケージがダウンロードおよびインストールされます
- プロジェクトをリロードして使用を開始
1.3. NuGetパッケージを直接ダウンロード
IronPDFは、IronPDF NuGetパッケージサイトに直接アクセスしてダウンロードすることでもインストールできます。 手順は次の通りです:
- IronPDF NuGetパッケージに移動
- ダウンロードパッケージを選択
- ダウンロードしたパッケージをダブルクリック
- パッケージはインストールされます
- Visual Studioプロジェクトをリロードし、使用を開始します
IronPDFはダウンロードされ、使用準備が整いました。 しかし、その前にApitron PDFライブラリをインストールする必要があります。
2. Apitron PDF Kitのインストール
.NET Coreアプリケーションの場合、NuGetパッケージマネージャーを使用してApitronをインストールするか、Apitron PDF Kit NuGetウェブサイトから直接ダウンロードしてインストールできます。
- IronPDFで行ったように、Visual StudioでNuGetパッケージを開く。
- Apitron.PDF.Kitを検索。
- 現在のプロジェクトでインストールをクリック。

アピトロンPDFキット検索
NuGetパッケージマネージャーコンソールを使用してApitronをインストールすることもできます。 IronPDFで記載されている"開発者コマンドプロンプトを使用する"手順に従い、次のコマンドを入力します:
ENTERキーを押す。 Apitron.PDF.Kitをダウンロードしてインストールします。
次の名前空間を追加します。
using Apitron.PDF.Kit;
using Apitron.PDF.Kit.FixedLayout.Resources;
using Apitron.PDF.Kit.FixedLayout.Resources.Fonts;
using Apitron.PDF.Kit.FlowLayout.Content;
using Apitron.PDF.Kit.Styles;
using Apitron.PDF.Kit.Styles.Appearance;
using Font = Apitron.PDF.Kit.Styles.Text.Font;Imports Apitron.PDF.Kit
Imports Apitron.PDF.Kit.FixedLayout.Resources
Imports Apitron.PDF.Kit.FixedLayout.Resources.Fonts
Imports Apitron.PDF.Kit.FlowLayout.Content
Imports Apitron.PDF.Kit.Styles
Imports Apitron.PDF.Kit.Styles.Appearance
Imports Font = Apitron.PDF.Kit.Styles.Text.FontImports Apitron.PDF.Kit
Imports Apitron.PDF.Kit.FixedLayout.Resources
Imports Apitron.PDF.Kit.FixedLayout.Resources.Fonts
Imports Apitron.PDF.Kit.FlowLayout.Content
Imports Apitron.PDF.Kit.Styles
Imports Apitron.PDF.Kit.Styles.Appearance
Imports Font = Apitron.PDF.Kit.Styles.Text.Fontそれでは、IronPDFとApitron PDFの比較に進みましょう。
3. PDFドキュメントの作成
3.1. IronPDFを使用する
IronPDFはPDFを作成するための複数のメソッドを持っています。 重要なものを2つ見てみましょう。
既存のURLをPDFに変換
IronPDFは、任意のURLをPDFに変換するのが簡単です。 次のコードはURLをPDFに変換するのに役立ちます。
var Renderer = new IronPdf.ChromePdfRenderer();
// Render a PDF from an existing URL
using var Pdf = Renderer.RenderUrlAsPdf("https://ironpdf.com/");
// Save the PDF to a file
Pdf.SaveAs("url.pdf");var Renderer = new IronPdf.ChromePdfRenderer();
// Render a PDF from an existing URL
using var Pdf = Renderer.RenderUrlAsPdf("https://ironpdf.com/");
// Save the PDF to a file
Pdf.SaveAs("url.pdf");Dim Renderer = New IronPdf.ChromePdfRenderer()
' Render a PDF from an existing URL
Dim Pdf = Renderer.RenderUrlAsPdf("https://ironpdf.com/")
' Save the PDF to a file
Pdf.SaveAs("url.pdf")Dim Renderer = New IronPdf.ChromePdfRenderer()
' Render a PDF from an existing URL
Dim Pdf = Renderer.RenderUrlAsPdf("https://ironpdf.com/")
' Save the PDF to a file
Pdf.SaveAs("url.pdf")HTML入力文字列をPDFに変換
以下のコードは、HTML文字列からPDFドキュメントをレンダリングする方法を説明しています。 HTMLだけを使うことも、CSSや画像、JavaScriptと組み合わせて使用することもできます。
var Renderer = new IronPdf.ChromePdfRenderer();
// Render a PDF from a simple HTML string
using var PDF = Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>");
PDF.SaveAs("pixel-perfect.pdf");
// Load external HTML assets like images, CSS, and JavaScript
// Set the optional BasePath as the file location to load assets from
using var AdvancedPDF = Renderer.RenderHtmlAsPdf("<img src='logo.png'><h1>Sample Text</h1>", @"C:\site\assets\");
AdvancedPDF.SaveAs("html-with-assets.pdf");var Renderer = new IronPdf.ChromePdfRenderer();
// Render a PDF from a simple HTML string
using var PDF = Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>");
PDF.SaveAs("pixel-perfect.pdf");
// Load external HTML assets like images, CSS, and JavaScript
// Set the optional BasePath as the file location to load assets from
using var AdvancedPDF = Renderer.RenderHtmlAsPdf("<img src='logo.png'><h1>Sample Text</h1>", @"C:\site\assets\");
AdvancedPDF.SaveAs("html-with-assets.pdf");Dim Renderer = New IronPdf.ChromePdfRenderer()
' Render a PDF from a simple HTML string
Dim PDF = Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>")
PDF.SaveAs("pixel-perfect.pdf")
' Load external HTML assets like images, CSS, and JavaScript
' Set the optional BasePath as the file location to load assets from
Dim AdvancedPDF = Renderer.RenderHtmlAsPdf("<img src='logo.png'><h1>Sample Text</h1>", "C:\site\assets\")
AdvancedPDF.SaveAs("html-with-assets.pdf")Dim Renderer = New IronPdf.ChromePdfRenderer()
' Render a PDF from a simple HTML string
Dim PDF = Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>")
PDF.SaveAs("pixel-perfect.pdf")
' Load external HTML assets like images, CSS, and JavaScript
' Set the optional BasePath as the file location to load assets from
Dim AdvancedPDF = Renderer.RenderHtmlAsPdf("<img src='logo.png'><h1>Sample Text</h1>", "C:\site\assets\")
AdvancedPDF.SaveAs("html-with-assets.pdf")出力は以下の通りです。

IronPDFはURLとHTML CSS文字列からPDFを生成します。
3.2. Apitron PDF Kitを使用
Apitron PDF では、URL または HTML を PDF に変換する方法は提供されていません。 PDFをHTMLに変換することはできます。 ただし、XML ファイルを PDF に変換することも行います。 使用するXMLファイルは以下のとおりです:
<?xml version="1.0" encoding="utf-8"?>
<FlowDocument xmlns="Apitron.PDF.Kit.FlowLayout.v1">
<Resources>
<Image resourceId="logo" fileName="../../images/logo.png" />
</Resources>
<Styles>
<Style selector="flowdocument">
<Color value="Black" />
</Style>
<Style selector="grid">
<InnerBorder thickness="1" />
<InnerBorderColor value="Black" />
</Style>
</Styles>
<Elements>
<Image>
<Properties>
<Class value="logo" />
<ResourceId value="logo" />
</Properties>
</Image>
<TextBlock>
<Properties>
<Class value="header" />
<Text value="Sample Interview Questions for Candidates" />
</Properties>
</TextBlock>
<Br />
<TextBlock>
<Properties>
<Class value="headerNote" />
<Text value="To help facilitate the interview process, the Human Resources Department has compiled a list of questions that might be used during the phone and/or on-campus interviews. Some of the questions deal with the same content, but are phrased differently while other questions may not pertain to a specific discipline; however all of the questions are unbiased and appropriate to ask. We hope you'll find this helpful." />
</Properties>
</TextBlock>
</Elements>
<Properties>
<Margin value="30,20,30,20" />
</Properties>
</FlowDocument>
このXMLテンプレートをPDFに変換するコードは次のとおりです:
// Use Apitron's FlowDocument to convert XML to PDF
using (Stream stream = File.OpenRead("C:\PLACE YOUR EXACT PATH HERE\template.xml"),
outputStream = File.Create("fromTemplate.pdf"))
{
ResourceManager resourceManager = new ResourceManager();
FlowDocument doc = FlowDocument.LoadFromXml(stream, resourceManager);
doc.Write(outputStream, resourceManager);
}// Use Apitron's FlowDocument to convert XML to PDF
using (Stream stream = File.OpenRead("C:\PLACE YOUR EXACT PATH HERE\template.xml"),
outputStream = File.Create("fromTemplate.pdf"))
{
ResourceManager resourceManager = new ResourceManager();
FlowDocument doc = FlowDocument.LoadFromXml(stream, resourceManager);
doc.Write(outputStream, resourceManager);
}' Use Apitron's FlowDocument to convert XML to PDF
Using stream As Stream = File.OpenRead("C:\PLACE YOUR EXACT PATH HERE\template.xml"),
outputStream As Stream = File.Create("fromTemplate.pdf")
Dim resourceManager As New ResourceManager()
Dim doc As FlowDocument = FlowDocument.LoadFromXml(stream, resourceManager)
doc.Write(outputStream, resourceManager)
End Using' Use Apitron's FlowDocument to convert XML to PDF
Using stream As Stream = File.OpenRead("C:\PLACE YOUR EXACT PATH HERE\template.xml"),
outputStream As Stream = File.Create("fromTemplate.pdf")
Dim resourceManager As New ResourceManager()
Dim doc As FlowDocument = FlowDocument.LoadFromXml(stream, resourceManager)
doc.Write(outputStream, resourceManager)
End Using出力は以下の通りです。

アピトロンPDFドキュメント
IronPDFとApitronの出力を比較すると、 IronPDFはHTMLレンダリングを使用し、画像サイズのスケーリングも行わずに、印象的なドキュメントを作成していることがはっきりとわかります。一方、ApitronはXMLファイルにスタイルが登録されている場合のみ、 IronPDFと同様の出力を生成します。
4. PDFドキュメントにヘッダーとフッターを追加
4.1. IronPDFを使用
IronPDFを使用すると、ヘッダーとフッターの追加は簡単です。 IronPDF を使用すると、ページ番号や改ページを追加したり、表紙や余白を添付したりできます。
ヘッダーとフッターを追加するコードは次のとおりです:
var Renderer = new ChromePdfRenderer();
// Add a header
Renderer.RenderingOptions.FirstPageNumber = 1; // Use 2 if a cover page will be appended
Renderer.RenderingOptions.TextHeader.DrawDividerLine = true;
Renderer.RenderingOptions.TextHeader.CenterText = "This is the header text";
Renderer.RenderingOptions.TextHeader.Font = IronPdf.Font.FontTypes.Helvetica;
Renderer.RenderingOptions.TextHeader.FontSize = 12;
Renderer.RenderingOptions.MarginTop = 25; // Create 25mm space for header
// Add a footer too
Renderer.RenderingOptions.TextFooter.DrawDividerLine = true;
Renderer.RenderingOptions.TextFooter.Font = IronPdf.Font.FontTypes.Arial;
Renderer.RenderingOptions.TextFooter.FontSize = 12;
Renderer.RenderingOptions.TextFooter.LeftText = "{date} {time}";
Renderer.RenderingOptions.TextFooter.RightText = "{page} of {total-pages}";
Renderer.RenderingOptions.MarginTop = 25; // Create 25mm space for footer
using var AdvancedPDF = Renderer.RenderHtmlAsPdf("<img src='logo.png'><h1>This is header and footer generated pdf file</h1>", @"C:\site\assets\");
AdvancedPDF.SaveAs("html-with-assets.pdf");var Renderer = new ChromePdfRenderer();
// Add a header
Renderer.RenderingOptions.FirstPageNumber = 1; // Use 2 if a cover page will be appended
Renderer.RenderingOptions.TextHeader.DrawDividerLine = true;
Renderer.RenderingOptions.TextHeader.CenterText = "This is the header text";
Renderer.RenderingOptions.TextHeader.Font = IronPdf.Font.FontTypes.Helvetica;
Renderer.RenderingOptions.TextHeader.FontSize = 12;
Renderer.RenderingOptions.MarginTop = 25; // Create 25mm space for header
// Add a footer too
Renderer.RenderingOptions.TextFooter.DrawDividerLine = true;
Renderer.RenderingOptions.TextFooter.Font = IronPdf.Font.FontTypes.Arial;
Renderer.RenderingOptions.TextFooter.FontSize = 12;
Renderer.RenderingOptions.TextFooter.LeftText = "{date} {time}";
Renderer.RenderingOptions.TextFooter.RightText = "{page} of {total-pages}";
Renderer.RenderingOptions.MarginTop = 25; // Create 25mm space for footer
using var AdvancedPDF = Renderer.RenderHtmlAsPdf("<img src='logo.png'><h1>This is header and footer generated pdf file</h1>", @"C:\site\assets\");
AdvancedPDF.SaveAs("html-with-assets.pdf");Dim Renderer = New ChromePdfRenderer()
' Add a header
Renderer.RenderingOptions.FirstPageNumber = 1 ' Use 2 if a cover page will be appended
Renderer.RenderingOptions.TextHeader.DrawDividerLine = True
Renderer.RenderingOptions.TextHeader.CenterText = "This is the header text"
Renderer.RenderingOptions.TextHeader.Font = IronPdf.Font.FontTypes.Helvetica
Renderer.RenderingOptions.TextHeader.FontSize = 12
Renderer.RenderingOptions.MarginTop = 25 ' Create 25mm space for header
' Add a footer too
Renderer.RenderingOptions.TextFooter.DrawDividerLine = True
Renderer.RenderingOptions.TextFooter.Font = IronPdf.Font.FontTypes.Arial
Renderer.RenderingOptions.TextFooter.FontSize = 12
Renderer.RenderingOptions.TextFooter.LeftText = "{date} {time}"
Renderer.RenderingOptions.TextFooter.RightText = "{page} of {total-pages}"
Renderer.RenderingOptions.MarginTop = 25 ' Create 25mm space for footer
Dim AdvancedPDF = Renderer.RenderHtmlAsPdf("<img src='logo.png'><h1>This is header and footer generated pdf file</h1>", "C:\site\assets\")
AdvancedPDF.SaveAs("html-with-assets.pdf")Dim Renderer = New ChromePdfRenderer()
' Add a header
Renderer.RenderingOptions.FirstPageNumber = 1 ' Use 2 if a cover page will be appended
Renderer.RenderingOptions.TextHeader.DrawDividerLine = True
Renderer.RenderingOptions.TextHeader.CenterText = "This is the header text"
Renderer.RenderingOptions.TextHeader.Font = IronPdf.Font.FontTypes.Helvetica
Renderer.RenderingOptions.TextHeader.FontSize = 12
Renderer.RenderingOptions.MarginTop = 25 ' Create 25mm space for header
' Add a footer too
Renderer.RenderingOptions.TextFooter.DrawDividerLine = True
Renderer.RenderingOptions.TextFooter.Font = IronPdf.Font.FontTypes.Arial
Renderer.RenderingOptions.TextFooter.FontSize = 12
Renderer.RenderingOptions.TextFooter.LeftText = "{date} {time}"
Renderer.RenderingOptions.TextFooter.RightText = "{page} of {total-pages}"
Renderer.RenderingOptions.MarginTop = 25 ' Create 25mm space for footer
Dim AdvancedPDF = Renderer.RenderHtmlAsPdf("<img src='logo.png'><h1>This is header and footer generated pdf file</h1>", "C:\site\assets\")
AdvancedPDF.SaveAs("html-with-assets.pdf")出力は以下の通りです。

IronPDF ヘッダーとフッター
4.2. Apitron PDF Kitを使用
Apitron PDF Kitは、XML構造形式のコンテンツをPDFに変換してPDFを作成します。 Apitron PDF Kitでは、PageFooterプロパティを使用してヘッダーとフッターを追加できます。 これを行うためのコードは以下のとおりです:
// Register document resources first
ResourceManager resourceManager = new ResourceManager();
resourceManager.RegisterResource(new Apitron.PDF.Kit.FixedLayout.Resources.XObjects.Image("logo", "../../data/logo.png"));
// Create the document
FlowDocument doc = new FlowDocument() { Margin = new Thickness(10) };
// Register styles
doc.StyleManager.RegisterStyle(".pageHeader", new Style() { Font = new Font(StandardFonts.TimesBold, 20) });
doc.StyleManager.RegisterStyle(".pageFooter", new Style() { Align = Align.Right });
doc.StyleManager.RegisterStyle("hr", new Style() { Height = 2, Margin = new Thickness(0, 5, 0, 5) });
doc.StyleManager.RegisterStyle(".content", new Style() { Align = Align.Left, Display = Display.InlineBlock });
// Fill the header section
doc.PageHeader.Class = "pageHeader";
doc.PageHeader.Add(new Image("logo") { Width = 100, Height = 50 });
doc.PageHeader.Add(new TextBlock("This document is intended for internal use only") { TextIndent = 20 });
doc.PageHeader.Add(new Hr());
// Fill the footer section
doc.PageFooter.Class = "pageFooter";
doc.PageFooter.Add(new Hr());
doc.PageFooter.Add(new TextBlock((ctx) => string.Format("Page {0} from ", ctx.CurrentPage + 1)));
doc.PageFooter.Add(new PageCount(3) { Display = Display.Inline });
// Add pages
for (int i = 0; i < 2; ++i)
{
doc.Add(new TextBlock("This is header and footer generation pdf file.") { Class = "content" });
doc.Add(new PageBreak());
}
// Generate PDF
using (Stream stream = File.Create("out.pdf"))
{
doc.Write(stream, resourceManager);
}
Process.Start("out.pdf");// Register document resources first
ResourceManager resourceManager = new ResourceManager();
resourceManager.RegisterResource(new Apitron.PDF.Kit.FixedLayout.Resources.XObjects.Image("logo", "../../data/logo.png"));
// Create the document
FlowDocument doc = new FlowDocument() { Margin = new Thickness(10) };
// Register styles
doc.StyleManager.RegisterStyle(".pageHeader", new Style() { Font = new Font(StandardFonts.TimesBold, 20) });
doc.StyleManager.RegisterStyle(".pageFooter", new Style() { Align = Align.Right });
doc.StyleManager.RegisterStyle("hr", new Style() { Height = 2, Margin = new Thickness(0, 5, 0, 5) });
doc.StyleManager.RegisterStyle(".content", new Style() { Align = Align.Left, Display = Display.InlineBlock });
// Fill the header section
doc.PageHeader.Class = "pageHeader";
doc.PageHeader.Add(new Image("logo") { Width = 100, Height = 50 });
doc.PageHeader.Add(new TextBlock("This document is intended for internal use only") { TextIndent = 20 });
doc.PageHeader.Add(new Hr());
// Fill the footer section
doc.PageFooter.Class = "pageFooter";
doc.PageFooter.Add(new Hr());
doc.PageFooter.Add(new TextBlock((ctx) => string.Format("Page {0} from ", ctx.CurrentPage + 1)));
doc.PageFooter.Add(new PageCount(3) { Display = Display.Inline });
// Add pages
for (int i = 0; i < 2; ++i)
{
doc.Add(new TextBlock("This is header and footer generation pdf file.") { Class = "content" });
doc.Add(new PageBreak());
}
// Generate PDF
using (Stream stream = File.Create("out.pdf"))
{
doc.Write(stream, resourceManager);
}
Process.Start("out.pdf");' Register document resources first
Dim resourceManager As New ResourceManager()
resourceManager.RegisterResource(New Apitron.PDF.Kit.FixedLayout.Resources.XObjects.Image("logo", "../../data/logo.png"))
' Create the document
Dim doc As New FlowDocument() With {.Margin = New Thickness(10)}
' Register styles
doc.StyleManager.RegisterStyle(".pageHeader", New Style() With {.Font = New Font(StandardFonts.TimesBold, 20)})
doc.StyleManager.RegisterStyle(".pageFooter", New Style() With {.Align = Align.Right})
doc.StyleManager.RegisterStyle("hr", New Style() With {
.Height = 2,
.Margin = New Thickness(0, 5, 0, 5)
})
doc.StyleManager.RegisterStyle(".content", New Style() With {
.Align = Align.Left,
.Display = Display.InlineBlock
})
' Fill the header section
doc.PageHeader.Class = "pageHeader"
doc.PageHeader.Add(New Image("logo") With {
.Width = 100,
.Height = 50
})
doc.PageHeader.Add(New TextBlock("This document is intended for internal use only") With {.TextIndent = 20})
doc.PageHeader.Add(New Hr())
' Fill the footer section
doc.PageFooter.Class = "pageFooter"
doc.PageFooter.Add(New Hr())
doc.PageFooter.Add(New TextBlock(Function(ctx) String.Format("Page {0} from ", ctx.CurrentPage + 1)))
doc.PageFooter.Add(New PageCount(3) With {.Display = Display.Inline})
' Add pages
For i As Integer = 0 To 1
doc.Add(New TextBlock("This is header and footer generation pdf file.") With {.Class = "content"})
doc.Add(New PageBreak())
Next i
' Generate PDF
Using stream As Stream = File.Create("out.pdf")
doc.Write(stream, resourceManager)
End Using
Process.Start("out.pdf")' Register document resources first
Dim resourceManager As New ResourceManager()
resourceManager.RegisterResource(New Apitron.PDF.Kit.FixedLayout.Resources.XObjects.Image("logo", "../../data/logo.png"))
' Create the document
Dim doc As New FlowDocument() With {.Margin = New Thickness(10)}
' Register styles
doc.StyleManager.RegisterStyle(".pageHeader", New Style() With {.Font = New Font(StandardFonts.TimesBold, 20)})
doc.StyleManager.RegisterStyle(".pageFooter", New Style() With {.Align = Align.Right})
doc.StyleManager.RegisterStyle("hr", New Style() With {
.Height = 2,
.Margin = New Thickness(0, 5, 0, 5)
})
doc.StyleManager.RegisterStyle(".content", New Style() With {
.Align = Align.Left,
.Display = Display.InlineBlock
})
' Fill the header section
doc.PageHeader.Class = "pageHeader"
doc.PageHeader.Add(New Image("logo") With {
.Width = 100,
.Height = 50
})
doc.PageHeader.Add(New TextBlock("This document is intended for internal use only") With {.TextIndent = 20})
doc.PageHeader.Add(New Hr())
' Fill the footer section
doc.PageFooter.Class = "pageFooter"
doc.PageFooter.Add(New Hr())
doc.PageFooter.Add(New TextBlock(Function(ctx) String.Format("Page {0} from ", ctx.CurrentPage + 1)))
doc.PageFooter.Add(New PageCount(3) With {.Display = Display.Inline})
' Add pages
For i As Integer = 0 To 1
doc.Add(New TextBlock("This is header and footer generation pdf file.") With {.Class = "content"})
doc.Add(New PageBreak())
Next i
' Generate PDF
Using stream As Stream = File.Create("out.pdf")
doc.Write(stream, resourceManager)
End Using
Process.Start("out.pdf")出力は以下の通りです。

アピトロンのヘッダーとフッター
5. PDFにデジタル署名を追加
5.1. IronPDFを使用
PDF処理の最も重要な機能の1つは、PDFドキュメントにデジタル署名を追加する能力です。 IronPDFはこれを行うために必要なすべてのツールを提供しています。
using IronPdf;
// Cryptographically sign an existing PDF in 1 line of code!
new IronPdf.Signing.PdfSignature("Iron.p12", "123456").SignPdfFile("any.pdf");
/***** Advanced example for more control *****/
// 1. Create a PDF
var Renderer = new IronPdf.ChromePdfRenderer();
var doc = Renderer.RenderHtmlAsPdf("<h1>Testing 2048 bit digital security</h1>");
// 2. Create a Signature.
// You may create a .pfx or .p12 PDF signing certificate using Adobe Acrobat Reader.
var signature = new IronPdf.Signing.PdfSignature("Iron.pfx", "123456");
// 3. Handwritten signature graphic
signature.LoadSignatureImageFromFile("handwriting.png");
// 4. Sign the PDF with the PdfSignature. Multiple signing certificates may be used
doc.SignPdfWithDigitalSignature(signature);
// 5. The PDF is not signed until saved to file, stream or byte array.
doc.SaveAs("signed.pdf");using IronPdf;
// Cryptographically sign an existing PDF in 1 line of code!
new IronPdf.Signing.PdfSignature("Iron.p12", "123456").SignPdfFile("any.pdf");
/***** Advanced example for more control *****/
// 1. Create a PDF
var Renderer = new IronPdf.ChromePdfRenderer();
var doc = Renderer.RenderHtmlAsPdf("<h1>Testing 2048 bit digital security</h1>");
// 2. Create a Signature.
// You may create a .pfx or .p12 PDF signing certificate using Adobe Acrobat Reader.
var signature = new IronPdf.Signing.PdfSignature("Iron.pfx", "123456");
// 3. Handwritten signature graphic
signature.LoadSignatureImageFromFile("handwriting.png");
// 4. Sign the PDF with the PdfSignature. Multiple signing certificates may be used
doc.SignPdfWithDigitalSignature(signature);
// 5. The PDF is not signed until saved to file, stream or byte array.
doc.SaveAs("signed.pdf");Imports IronPdf
' Cryptographically sign an existing PDF in 1 line of code!
Call (New IronPdf.Signing.PdfSignature("Iron.p12", "123456")).SignPdfFile("any.pdf")
'''*** Advanced example for more control ****
' 1. Create a PDF
Dim Renderer = New IronPdf.ChromePdfRenderer()
Dim doc = Renderer.RenderHtmlAsPdf("<h1>Testing 2048 bit digital security</h1>")
' 2. Create a Signature.
' You may create a .pfx or .p12 PDF signing certificate using Adobe Acrobat Reader.
Dim signature = New IronPdf.Signing.PdfSignature("Iron.pfx", "123456")
' 3. Handwritten signature graphic
signature.LoadSignatureImageFromFile("handwriting.png")
' 4. Sign the PDF with the PdfSignature. Multiple signing certificates may be used
doc.SignPdfWithDigitalSignature(signature)
' 5. The PDF is not signed until saved to file, stream or byte array.
doc.SaveAs("signed.pdf")Imports IronPdf
' Cryptographically sign an existing PDF in 1 line of code!
Call (New IronPdf.Signing.PdfSignature("Iron.p12", "123456")).SignPdfFile("any.pdf")
'''*** Advanced example for more control ****
' 1. Create a PDF
Dim Renderer = New IronPdf.ChromePdfRenderer()
Dim doc = Renderer.RenderHtmlAsPdf("<h1>Testing 2048 bit digital security</h1>")
' 2. Create a Signature.
' You may create a .pfx or .p12 PDF signing certificate using Adobe Acrobat Reader.
Dim signature = New IronPdf.Signing.PdfSignature("Iron.pfx", "123456")
' 3. Handwritten signature graphic
signature.LoadSignatureImageFromFile("handwriting.png")
' 4. Sign the PDF with the PdfSignature. Multiple signing certificates may be used
doc.SignPdfWithDigitalSignature(signature)
' 5. The PDF is not signed until saved to file, stream or byte array.
doc.SaveAs("signed.pdf")5.2 Apitron PDF Kitを使用
Apitron PDF Kitを使用したPDFへの署名のスタンプは、長くて技術的なプロセスです。
static void Main(string[] args)
{
string fileName = "signedTwice.pdf";
using (Stream stream = File.Create(fileName))
{
FlowDocument doc = new FlowDocument() { Margin = new Thickness(10) };
doc.Add(new TextBlock("Signed using Apitron PDF Kit for .NET"));
doc.Write(stream, new ResourceManager());
}
// Save
Sign(fileName, "../../data/certs/JohnDoe.pfx", "password", "../../data/images/signatureImage.png", new Boundary(10, 750, 110, 800));
}
// Implementation of Sign Method
private static void Sign(string pathToDocument, string pathToCertificate, string password, string pathToSignatureImage, Boundary signatureViewLocation)
{
// Open existing document and sign once
using (Stream inputStream = new FileStream(pathToDocument, FileMode.Open, FileAccess.ReadWrite))
{
using (FixedDocument doc = new FixedDocument(inputStream))
{
string imageResourceId = Guid.NewGuid().ToString("N");
string signatureFieldId = Guid.NewGuid().ToString("N");
// Register signature image resource
doc.ResourceManager.RegisterResource(new Image(imageResourceId, pathToSignatureImage));
// Create first signature field and initialize it using a stored certificate
SignatureField signatureField = new SignatureField(signatureFieldId);
using (Stream signatureDataStream = File.OpenRead(pathToCertificate))
{
signatureField.Signature = Signature.Create(new Pkcs12Store(signatureDataStream, password));
}
// Add signature fields to the document
doc.AcroForm.Fields.Add(signatureField);
// Create first signature view using the image resource
SignatureFieldView signatureView = new SignatureFieldView(signatureField, signatureViewLocation);
signatureView.ViewSettings.Graphic = Graphic.Image;
signatureView.ViewSettings.GraphicResourceID = imageResourceId;
signatureView.ViewSettings.Description = Description.None;
// Add views to page annotations collection
doc.Pages[0].Annotations.Add(signatureView);
// Save as incremental update
doc.Save();
}
}
}static void Main(string[] args)
{
string fileName = "signedTwice.pdf";
using (Stream stream = File.Create(fileName))
{
FlowDocument doc = new FlowDocument() { Margin = new Thickness(10) };
doc.Add(new TextBlock("Signed using Apitron PDF Kit for .NET"));
doc.Write(stream, new ResourceManager());
}
// Save
Sign(fileName, "../../data/certs/JohnDoe.pfx", "password", "../../data/images/signatureImage.png", new Boundary(10, 750, 110, 800));
}
// Implementation of Sign Method
private static void Sign(string pathToDocument, string pathToCertificate, string password, string pathToSignatureImage, Boundary signatureViewLocation)
{
// Open existing document and sign once
using (Stream inputStream = new FileStream(pathToDocument, FileMode.Open, FileAccess.ReadWrite))
{
using (FixedDocument doc = new FixedDocument(inputStream))
{
string imageResourceId = Guid.NewGuid().ToString("N");
string signatureFieldId = Guid.NewGuid().ToString("N");
// Register signature image resource
doc.ResourceManager.RegisterResource(new Image(imageResourceId, pathToSignatureImage));
// Create first signature field and initialize it using a stored certificate
SignatureField signatureField = new SignatureField(signatureFieldId);
using (Stream signatureDataStream = File.OpenRead(pathToCertificate))
{
signatureField.Signature = Signature.Create(new Pkcs12Store(signatureDataStream, password));
}
// Add signature fields to the document
doc.AcroForm.Fields.Add(signatureField);
// Create first signature view using the image resource
SignatureFieldView signatureView = new SignatureFieldView(signatureField, signatureViewLocation);
signatureView.ViewSettings.Graphic = Graphic.Image;
signatureView.ViewSettings.GraphicResourceID = imageResourceId;
signatureView.ViewSettings.Description = Description.None;
// Add views to page annotations collection
doc.Pages[0].Annotations.Add(signatureView);
// Save as incremental update
doc.Save();
}
}
}Imports System
Imports System.IO
Imports Apitron.PDF.Rasterizer
Imports Apitron.PDF.Kit.FixedLayout
Imports Apitron.PDF.Kit
Imports Apitron.PDF.Kit.Styles
Imports Apitron.PDF.Kit.Signatures
Imports Apitron.PDF.Kit.Interactive.Annotations
Module Module1
Sub Main(args As String())
Dim fileName As String = "signedTwice.pdf"
Using stream As Stream = File.Create(fileName)
Dim doc As New FlowDocument() With {.Margin = New Thickness(10)}
doc.Add(New TextBlock("Signed using Apitron PDF Kit for .NET"))
doc.Write(stream, New ResourceManager())
End Using
' Save
Sign(fileName, "../../data/certs/JohnDoe.pfx", "password", "../../data/images/signatureImage.png", New Boundary(10, 750, 110, 800))
End Sub
' Implementation of Sign Method
Private Sub Sign(pathToDocument As String, pathToCertificate As String, password As String, pathToSignatureImage As String, signatureViewLocation As Boundary)
' Open existing document and sign once
Using inputStream As Stream = New FileStream(pathToDocument, FileMode.Open, FileAccess.ReadWrite)
Using doc As New FixedDocument(inputStream)
Dim imageResourceId As String = Guid.NewGuid().ToString("N")
Dim signatureFieldId As String = Guid.NewGuid().ToString("N")
' Register signature image resource
doc.ResourceManager.RegisterResource(New Image(imageResourceId, pathToSignatureImage))
' Create first signature field and initialize it using a stored certificate
Dim signatureField As New SignatureField(signatureFieldId)
Using signatureDataStream As Stream = File.OpenRead(pathToCertificate)
signatureField.Signature = Signature.Create(New Pkcs12Store(signatureDataStream, password))
End Using
' Add signature fields to the document
doc.AcroForm.Fields.Add(signatureField)
' Create first signature view using the image resource
Dim signatureView As New SignatureFieldView(signatureField, signatureViewLocation)
signatureView.ViewSettings.Graphic = Graphic.Image
signatureView.ViewSettings.GraphicResourceID = imageResourceId
signatureView.ViewSettings.Description = Description.None
' Add views to page annotations collection
doc.Pages(0).Annotations.Add(signatureView)
' Save as incremental update
doc.Save()
End Using
End Using
End Sub
End ModuleImports System
Imports System.IO
Imports Apitron.PDF.Rasterizer
Imports Apitron.PDF.Kit.FixedLayout
Imports Apitron.PDF.Kit
Imports Apitron.PDF.Kit.Styles
Imports Apitron.PDF.Kit.Signatures
Imports Apitron.PDF.Kit.Interactive.Annotations
Module Module1
Sub Main(args As String())
Dim fileName As String = "signedTwice.pdf"
Using stream As Stream = File.Create(fileName)
Dim doc As New FlowDocument() With {.Margin = New Thickness(10)}
doc.Add(New TextBlock("Signed using Apitron PDF Kit for .NET"))
doc.Write(stream, New ResourceManager())
End Using
' Save
Sign(fileName, "../../data/certs/JohnDoe.pfx", "password", "../../data/images/signatureImage.png", New Boundary(10, 750, 110, 800))
End Sub
' Implementation of Sign Method
Private Sub Sign(pathToDocument As String, pathToCertificate As String, password As String, pathToSignatureImage As String, signatureViewLocation As Boundary)
' Open existing document and sign once
Using inputStream As Stream = New FileStream(pathToDocument, FileMode.Open, FileAccess.ReadWrite)
Using doc As New FixedDocument(inputStream)
Dim imageResourceId As String = Guid.NewGuid().ToString("N")
Dim signatureFieldId As String = Guid.NewGuid().ToString("N")
' Register signature image resource
doc.ResourceManager.RegisterResource(New Image(imageResourceId, pathToSignatureImage))
' Create first signature field and initialize it using a stored certificate
Dim signatureField As New SignatureField(signatureFieldId)
Using signatureDataStream As Stream = File.OpenRead(pathToCertificate)
signatureField.Signature = Signature.Create(New Pkcs12Store(signatureDataStream, password))
End Using
' Add signature fields to the document
doc.AcroForm.Fields.Add(signatureField)
' Create first signature view using the image resource
Dim signatureView As New SignatureFieldView(signatureField, signatureViewLocation)
signatureView.ViewSettings.Graphic = Graphic.Image
signatureView.ViewSettings.GraphicResourceID = imageResourceId
signatureView.ViewSettings.Description = Description.None
' Add views to page annotations collection
doc.Pages(0).Annotations.Add(signatureView)
' Save as incremental update
doc.Save()
End Using
End Using
End Sub
End Moduleライブラリの出力はほぼ同じです。 IronPDFがPDFコンテンツの操作にはるかに簡単で便利であることが明らかです。 出力されたPDFは、証明書と印刷された署名で署名されています。
IronPDFを使用したBootstrap 5でのポートフォリオギャラリー
IronPDFのChrome V8レンダリングエンジンは、最新のBootstrap 5コンポーネントを完全にサポートしており、プロフェッショナルなポートフォリオギャラリーで視覚的に驚くべきPDFドキュメントを生成することができます。 この例では、グリッドレイアウト、ホバー効果、グラデーションオーバーレイ、カテゴリバッジをデモンストレーションしています - Apitron PDF SDKのような従来のPDFライブラリで実装するのが困難な機能です。
using IronPdf;
var renderer = new ChromePdfRenderer();
string portfolioGallery = @"
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<link href='https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css' rel='stylesheet'>
<style>
.gallery-item {
position: relative;
overflow: hidden;
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.gallery-item img {
width: 100%;
height: 250px;
object-fit: cover;
transition: transform 0.3s;
}
.gallery-item:hover img {
transform: scale(1.1);
}
.gallery-overlay {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
padding: 20px;
color: white;
}
.category-badge {
position: absolute;
top: 10px;
right: 10px;
}
@media print {
.gallery-item { page-break-inside: avoid; }
}
</style>
</head>
<body>
<div class='container py-5'>
<div class='text-center mb-5'>
<h1 class='display-4'>Design Portfolio</h1>
<p class='lead text-muted'>Showcase of PDF Document Designs</p>
</div>
<div class='row mb-4'>
<div class='col-12'>
<div class='btn-group' role='group'>
<button class='btn btn-primary'>All Projects</button>
<button class='btn btn-outline-primary'>Invoices</button>
<button class='btn btn-outline-primary'>Reports</button>
<button class='btn btn-outline-primary'>Forms</button>
<button class='btn btn-outline-primary'>Certificates</button>
</div>
</div>
</div>
<div class='row g-4'>
<div class='col-md-4'>
<div class='gallery-item'>
<span class='badge bg-primary category-badge'>Invoice</span>
<svg width='100%' height='250' style='background: linear-gradient(135deg, #667eea 0%, #764ba2 100%)'>
<text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>📄</text>
</svg>
<div class='gallery-overlay'>
<h5 class='mb-1'>Professional Invoice Template</h5>
<small>Corporate billing with itemized details</small>
</div>
</div>
</div>
<div class='col-md-4'>
<div class='gallery-item'>
<span class='badge bg-success category-badge'>Report</span>
<svg width='100%' height='250' style='background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%)'>
<text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>📊</text>
</svg>
<div class='gallery-overlay'>
<h5 class='mb-1'>Analytics Dashboard Report</h5>
<small>Data visualization and metrics</small>
</div>
</div>
</div>
<div class='col-md-4'>
<div class='gallery-item'>
<span class='badge bg-warning category-badge'>Certificate</span>
<svg width='100%' height='250' style='background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)'>
<text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>🏆</text>
</svg>
<div class='gallery-overlay'>
<h5 class='mb-1'>Award Certificate</h5>
<small>Professional achievement recognition</small>
</div>
</div>
</div>
<div class='col-md-4'>
<div class='gallery-item'>
<span class='badge bg-info category-badge'>Form</span>
<svg width='100%' height='250' style='background: linear-gradient(135deg, #fa709a 0%, #fee140 100%)'>
<text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>📝</text>
</svg>
<div class='gallery-overlay'>
<h5 class='mb-1'>Application Form</h5>
<small>Multi-page data collection</small>
</div>
</div>
</div>
<div class='col-md-4'>
<div class='gallery-item'>
<span class='badge bg-danger category-badge'>Invoice</span>
<svg width='100%' height='250' style='background: linear-gradient(135deg, #30cfd0 0%, #330867 100%)'>
<text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>💰</text>
</svg>
<div class='gallery-overlay'>
<h5 class='mb-1'>Payment Receipt</h5>
<small>Transaction confirmation document</small>
</div>
</div>
</div>
<div class='col-md-4'>
<div class='gallery-item'>
<span class='badge bg-secondary category-badge'>Report</span>
<svg width='100%' height='250' style='background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%)'>
<text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>📈</text>
</svg>
<div class='gallery-overlay'>
<h5 class='mb-1'>Financial Statement</h5>
<small>Quarterly performance overview</small>
</div>
</div>
</div>
</div>
<div class='text-center mt-5'>
<p class='text-muted'>All templates rendered with IronPDF's Chromium engine</p>
<div class='d-flex justify-content-center gap-2'>
<span class='badge bg-primary'>Bootstrap 5</span>
<span class='badge bg-success'>Responsive</span>
<span class='badge bg-info'>Print-Ready</span>
</div>
</div>
</div>
</body>
</html>";
var pdf = renderer.RenderHtmlAsPdf(portfolioGallery);
pdf.SaveAs("portfolio-gallery.pdf");using IronPdf;
var renderer = new ChromePdfRenderer();
string portfolioGallery = @"
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<link href='https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css' rel='stylesheet'>
<style>
.gallery-item {
position: relative;
overflow: hidden;
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.gallery-item img {
width: 100%;
height: 250px;
object-fit: cover;
transition: transform 0.3s;
}
.gallery-item:hover img {
transform: scale(1.1);
}
.gallery-overlay {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
padding: 20px;
color: white;
}
.category-badge {
position: absolute;
top: 10px;
right: 10px;
}
@media print {
.gallery-item { page-break-inside: avoid; }
}
</style>
</head>
<body>
<div class='container py-5'>
<div class='text-center mb-5'>
<h1 class='display-4'>Design Portfolio</h1>
<p class='lead text-muted'>Showcase of PDF Document Designs</p>
</div>
<div class='row mb-4'>
<div class='col-12'>
<div class='btn-group' role='group'>
<button class='btn btn-primary'>All Projects</button>
<button class='btn btn-outline-primary'>Invoices</button>
<button class='btn btn-outline-primary'>Reports</button>
<button class='btn btn-outline-primary'>Forms</button>
<button class='btn btn-outline-primary'>Certificates</button>
</div>
</div>
</div>
<div class='row g-4'>
<div class='col-md-4'>
<div class='gallery-item'>
<span class='badge bg-primary category-badge'>Invoice</span>
<svg width='100%' height='250' style='background: linear-gradient(135deg, #667eea 0%, #764ba2 100%)'>
<text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>📄</text>
</svg>
<div class='gallery-overlay'>
<h5 class='mb-1'>Professional Invoice Template</h5>
<small>Corporate billing with itemized details</small>
</div>
</div>
</div>
<div class='col-md-4'>
<div class='gallery-item'>
<span class='badge bg-success category-badge'>Report</span>
<svg width='100%' height='250' style='background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%)'>
<text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>📊</text>
</svg>
<div class='gallery-overlay'>
<h5 class='mb-1'>Analytics Dashboard Report</h5>
<small>Data visualization and metrics</small>
</div>
</div>
</div>
<div class='col-md-4'>
<div class='gallery-item'>
<span class='badge bg-warning category-badge'>Certificate</span>
<svg width='100%' height='250' style='background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)'>
<text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>🏆</text>
</svg>
<div class='gallery-overlay'>
<h5 class='mb-1'>Award Certificate</h5>
<small>Professional achievement recognition</small>
</div>
</div>
</div>
<div class='col-md-4'>
<div class='gallery-item'>
<span class='badge bg-info category-badge'>Form</span>
<svg width='100%' height='250' style='background: linear-gradient(135deg, #fa709a 0%, #fee140 100%)'>
<text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>📝</text>
</svg>
<div class='gallery-overlay'>
<h5 class='mb-1'>Application Form</h5>
<small>Multi-page data collection</small>
</div>
</div>
</div>
<div class='col-md-4'>
<div class='gallery-item'>
<span class='badge bg-danger category-badge'>Invoice</span>
<svg width='100%' height='250' style='background: linear-gradient(135deg, #30cfd0 0%, #330867 100%)'>
<text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>💰</text>
</svg>
<div class='gallery-overlay'>
<h5 class='mb-1'>Payment Receipt</h5>
<small>Transaction confirmation document</small>
</div>
</div>
</div>
<div class='col-md-4'>
<div class='gallery-item'>
<span class='badge bg-secondary category-badge'>Report</span>
<svg width='100%' height='250' style='background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%)'>
<text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>📈</text>
</svg>
<div class='gallery-overlay'>
<h5 class='mb-1'>Financial Statement</h5>
<small>Quarterly performance overview</small>
</div>
</div>
</div>
</div>
<div class='text-center mt-5'>
<p class='text-muted'>All templates rendered with IronPDF's Chromium engine</p>
<div class='d-flex justify-content-center gap-2'>
<span class='badge bg-primary'>Bootstrap 5</span>
<span class='badge bg-success'>Responsive</span>
<span class='badge bg-info'>Print-Ready</span>
</div>
</div>
</div>
</body>
</html>";
var pdf = renderer.RenderHtmlAsPdf(portfolioGallery);
pdf.SaveAs("portfolio-gallery.pdf");Imports IronPdf
Dim renderer As New ChromePdfRenderer()
Dim portfolioGallery As String = "
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<link href='https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css' rel='stylesheet'>
<style>
.gallery-item {
position: relative;
overflow: hidden;
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.gallery-item img {
width: 100%;
height: 250px;
object-fit: cover;
transition: transform 0.3s;
}
.gallery-item:hover img {
transform: scale(1.1);
}
.gallery-overlay {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
padding: 20px;
color: white;
}
.category-badge {
position: absolute;
top: 10px;
right: 10px;
}
@media print {
.gallery-item { page-break-inside: avoid; }
}
</style>
</head>
<body>
<div class='container py-5'>
<div class='text-center mb-5'>
<h1 class='display-4'>Design Portfolio</h1>
<p class='lead text-muted'>Showcase of PDF Document Designs</p>
</div>
<div class='row mb-4'>
<div class='col-12'>
<div class='btn-group' role='group'>
<button class='btn btn-primary'>All Projects</button>
<button class='btn btn-outline-primary'>Invoices</button>
<button class='btn btn-outline-primary'>Reports</button>
<button class='btn btn-outline-primary'>Forms</button>
<button class='btn btn-outline-primary'>Certificates</button>
</div>
</div>
</div>
<div class='row g-4'>
<div class='col-md-4'>
<div class='gallery-item'>
<span class='badge bg-primary category-badge'>Invoice</span>
<svg width='100%' height='250' style='background: linear-gradient(135deg, #667eea 0%, #764ba2 100%)'>
<text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>📄</text>
</svg>
<div class='gallery-overlay'>
<h5 class='mb-1'>Professional Invoice Template</h5>
<small>Corporate billing with itemized details</small>
</div>
</div>
</div>
<div class='col-md-4'>
<div class='gallery-item'>
<span class='badge bg-success category-badge'>Report</span>
<svg width='100%' height='250' style='background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%)'>
<text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>📊</text>
</svg>
<div class='gallery-overlay'>
<h5 class='mb-1'>Analytics Dashboard Report</h5>
<small>Data visualization and metrics</small>
</div>
</div>
</div>
<div class='col-md-4'>
<div class='gallery-item'>
<span class='badge bg-warning category-badge'>Certificate</span>
<svg width='100%' height='250' style='background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)'>
<text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>🏆</text>
</svg>
<div class='gallery-overlay'>
<h5 class='mb-1'>Award Certificate</h5>
<small>Professional achievement recognition</small>
</div>
</div>
</div>
<div class='col-md-4'>
<div class='gallery-item'>
<span class='badge bg-info category-badge'>Form</span>
<svg width='100%' height='250' style='background: linear-gradient(135deg, #fa709a 0%, #fee140 100%)'>
<text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>📝</text>
</svg>
<div class='gallery-overlay'>
<h5 class='mb-1'>Application Form</h5>
<small>Multi-page data collection</small>
</div>
</div>
</div>
<div class='col-md-4'>
<div class='gallery-item'>
<span class='badge bg-danger category-badge'>Invoice</span>
<svg width='100%' height='250' style='background: linear-gradient(135deg, #30cfd0 0%, #330867 100%)'>
<text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>💰</text>
</svg>
<div class='gallery-overlay'>
<h5 class='mb-1'>Payment Receipt</h5>
<small>Transaction confirmation document</small>
</div>
</div>
</div>
<div class='col-md-4'>
<div class='gallery-item'>
<span class='badge bg-secondary category-badge'>Report</span>
<svg width='100%' height='250' style='background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%)'>
<text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>📈</text>
</svg>
<div class='gallery-overlay'>
<h5 class='mb-1'>Financial Statement</h5>
<small>Quarterly performance overview</small>
</div>
</div>
</div>
</div>
<div class='text-center mt-5'>
<p class='text-muted'>All templates rendered with IronPDF's Chromium engine</p>
<div class='d-flex justify-content-center gap-2'>
<span class='badge bg-primary'>Bootstrap 5</span>
<span class='badge bg-success'>Responsive</span>
<span class='badge bg-info'>Print-Ready</span>
</div>
</div>
</div>
</body>
</html>"
Dim pdf = renderer.RenderHtmlAsPdf(portfolioGallery)
pdf.SaveAs("portfolio-gallery.pdf")Imports IronPdf
Dim renderer As New ChromePdfRenderer()
Dim portfolioGallery As String = "
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<link href='https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css' rel='stylesheet'>
<style>
.gallery-item {
position: relative;
overflow: hidden;
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.gallery-item img {
width: 100%;
height: 250px;
object-fit: cover;
transition: transform 0.3s;
}
.gallery-item:hover img {
transform: scale(1.1);
}
.gallery-overlay {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
padding: 20px;
color: white;
}
.category-badge {
position: absolute;
top: 10px;
right: 10px;
}
@media print {
.gallery-item { page-break-inside: avoid; }
}
</style>
</head>
<body>
<div class='container py-5'>
<div class='text-center mb-5'>
<h1 class='display-4'>Design Portfolio</h1>
<p class='lead text-muted'>Showcase of PDF Document Designs</p>
</div>
<div class='row mb-4'>
<div class='col-12'>
<div class='btn-group' role='group'>
<button class='btn btn-primary'>All Projects</button>
<button class='btn btn-outline-primary'>Invoices</button>
<button class='btn btn-outline-primary'>Reports</button>
<button class='btn btn-outline-primary'>Forms</button>
<button class='btn btn-outline-primary'>Certificates</button>
</div>
</div>
</div>
<div class='row g-4'>
<div class='col-md-4'>
<div class='gallery-item'>
<span class='badge bg-primary category-badge'>Invoice</span>
<svg width='100%' height='250' style='background: linear-gradient(135deg, #667eea 0%, #764ba2 100%)'>
<text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>📄</text>
</svg>
<div class='gallery-overlay'>
<h5 class='mb-1'>Professional Invoice Template</h5>
<small>Corporate billing with itemized details</small>
</div>
</div>
</div>
<div class='col-md-4'>
<div class='gallery-item'>
<span class='badge bg-success category-badge'>Report</span>
<svg width='100%' height='250' style='background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%)'>
<text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>📊</text>
</svg>
<div class='gallery-overlay'>
<h5 class='mb-1'>Analytics Dashboard Report</h5>
<small>Data visualization and metrics</small>
</div>
</div>
</div>
<div class='col-md-4'>
<div class='gallery-item'>
<span class='badge bg-warning category-badge'>Certificate</span>
<svg width='100%' height='250' style='background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)'>
<text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>🏆</text>
</svg>
<div class='gallery-overlay'>
<h5 class='mb-1'>Award Certificate</h5>
<small>Professional achievement recognition</small>
</div>
</div>
</div>
<div class='col-md-4'>
<div class='gallery-item'>
<span class='badge bg-info category-badge'>Form</span>
<svg width='100%' height='250' style='background: linear-gradient(135deg, #fa709a 0%, #fee140 100%)'>
<text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>📝</text>
</svg>
<div class='gallery-overlay'>
<h5 class='mb-1'>Application Form</h5>
<small>Multi-page data collection</small>
</div>
</div>
</div>
<div class='col-md-4'>
<div class='gallery-item'>
<span class='badge bg-danger category-badge'>Invoice</span>
<svg width='100%' height='250' style='background: linear-gradient(135deg, #30cfd0 0%, #330867 100%)'>
<text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>💰</text>
</svg>
<div class='gallery-overlay'>
<h5 class='mb-1'>Payment Receipt</h5>
<small>Transaction confirmation document</small>
</div>
</div>
</div>
<div class='col-md-4'>
<div class='gallery-item'>
<span class='badge bg-secondary category-badge'>Report</span>
<svg width='100%' height='250' style='background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%)'>
<text x='50%' y='50%' text-anchor='middle' fill='white' font-size='48' opacity='0.3'>📈</text>
</svg>
<div class='gallery-overlay'>
<h5 class='mb-1'>Financial Statement</h5>
<small>Quarterly performance overview</small>
</div>
</div>
</div>
</div>
<div class='text-center mt-5'>
<p class='text-muted'>All templates rendered with IronPDF's Chromium engine</p>
<div class='d-flex justify-content-center gap-2'>
<span class='badge bg-primary'>Bootstrap 5</span>
<span class='badge bg-success'>Responsive</span>
<span class='badge bg-info'>Print-Ready</span>
</div>
</div>
</div>
</body>
</html>"
Dim pdf = renderer.RenderHtmlAsPdf(portfolioGallery)
pdf.SaveAs("portfolio-gallery.pdf")このコードは、レスポンシブグリッドレイアウト、視覚的なカテゴリバッジ、グラデーションオーバーレイ、およびホバー効果を備えたプロフェッショナルなPDFポートフォリオを生成します。 Chromeレンダリングエンジンは、すべてのBootstrapスタイリング、CSSグリッドレイアウト、およびカスタムCSSプロパティを保持します - これを従来のPDFライブラリは再現するのが難しいです。
Apitron PDF SDKに対する主な利点:
- 変換なしでネイティブBootstrap 5のサポート
- CSSグリッドとフレックスボックスレイアウトが完全にレンダリングされます
- グラデーション背景と最新のCSS効果
- より簡単なコードとより高品質な出力
Bootstrap PDF生成の完全ガイドについては、HTML to PDF Bootstrap Guideをご覧ください。
6. 価格とライセンス
IronPDFの価格とライセンス
IronPDFは開発用に無料で使用でき、商用使用にはいつでもライセンス化できます。単一の開発者、代理店、多国籍組織、SaaSおよびOEM再配布用のプロジェクトライセンスも利用可能です。 すべてのライセンスには、30日間の返金保証、1年のサポートとアップグレード、開発/ステージング/製品機能の有効性、および永続ライセンス(1回限りの購入)が提供されます。
Liteパッケージは$999で入手可能で、再発的な支出はありません。 最良のライセンスを選択するための詳細と支援は、IronPDF製品ライセンスページで入手できます。

IronPDF のライセンス
Apitron PDF Kitの価格とライセンス
現在使用されているライセンススキームは2つあります - モダンとレガシーです。 すでにライセンスをお持ちの場合、レガシーライセンススキームはライセンスが期限切れになるまで有効です。 その後、移行のためにカスタマーサポートに連絡する必要があります。 モダンライセンススキームは、新しい顧客にだけ適用されます。
モダンスキームの下で、次の3つのライセンステイヤーがあります:
- 評価 - 完全機能の製品を使用するための3ヶ月の評価期間。 NuGetからパッケージをダウンロードして開発を開始。
- コミュニティ - あなたの非商用プロジェクトで無料で完全に機能する製品を使用します。 承認が必要です。
- 商用 - 上記の記述に該当しないあらゆるユースケース。 価格は使用パターンに依存します。
結論
IronPDFライブラリは、HTML、JS、CSS、JPG、PNG、GIF、SVGなどのドキュメントタイプからピクセルパーフェクトなPDFを作成します。 Chromiumエンジンは、完璧なPDFを出力として提供するためにHTMLファイルやURLをレンダリングするのに役立ちます。
Apitronは、100% PDF仕様互換で実装された固定レイアウトAPIを使用してPDFを作成することを可能にします。 HTMLおよびCSSに似たスタイル駆動のコンテンツ生成メソッドとして、この固定レイアウトAPIは、素晴らしいレポート、請求書、カタログなどをわずか数分で作成する能力を提供します。 また、XMLテンプレートの作成もサポートしています。
Apitron PDFのライセンス価格はそのウェブサイトには掲載されていません。サポートに連絡して使用に基づいた見積もりを取得する必要があります。 一方で、IronPDFはそのウェブサイトで非常に明確なライセンスポリシーを表示しており、これによりIronPDFは競合製品より際立ち、ユーザーが自身のニーズに応じて賢く選択できるようにしています。
IronPDFを使用すると、Apitron PDFよりも簡単にPDFファイルを操作できます。 IronPDFは、挑戦的なPDFジョブに対して、ユーザーがより少ないコード行を書くことを可能にします。 IronPDFは複数のファイルタイプからPDFを生成する複数のメソッドを提供しますが、ApitronはXMLドキュメントをPDFドキュメントに変換することのみ可能です。 Apitronと比較して、IronPDFでは技術的オプションを追加することなく完璧な出力が得られます。
Iron Softwareのすべての顧客は、2つの製品の価格で同社の5つの製品すべてを購入するオプションがあります。 IronPDFの無料30日間の試用版を試して、その完全な機能をテストしてください。 Iron Software製品のフルスイートを購入する IronSoftware.comで。
Curtis Chauは、カールトン大学でコンピュータサイエンスの学士号を取得し、Node.js、TypeScript、JavaScript、およびReactに精通したフロントエンド開発を専門としています。直感的で美しいユーザーインターフェースを作成することに情熱を持ち、Curtisは現代のフレームワークを用いた開発や、構造の良い視覚的に魅力的なマニュアルの作成を楽しんでいます。