透かしなしで本番環境でテストしてください。
必要な場所で動作します。
30日間、完全に機能する製品をご利用いただけます。
数分で稼働させることができます。
製品トライアル期間中にサポートエンジニアリングチームへの完全アクセス
.NET 環境で PDF ファイルを扱う際には、開発者は、文書の作成、編集、暗号化、HTML から PDF への変換のような一般的なタスクを処理するための信頼性が高く、機能豊富なライブラリが必要です。 IronPDF と PDFsharp は、2つの人気のあるライブラリですが、それぞれ異なるニーズに応えます。
IronPDFは、HTMLからPDFへの変換、PDFのセキュリティ、そして高度なPDF操作に優れた、機能満載で高性能なPDFライブラリです。 一方、PDFsharpは、PDFの作成と基本的な編集に特化した軽量なオープンソースライブラリです。 それらの選択は、プロジェクトの複雑さと要件によります。
このガイドでは、IronPDFとPDFsharpを重要な機能、使いやすさ、セキュリティ、価格設定、サポートの面で比較し、.NETアプリケーションに最適なツールを判断するのに役立てます。
IronPDF は、HTMLからPDFへの変換、PDFの編集、セキュアなドキュメント処理を含む多くの分野で優れた機能を持つ、機能満載の.NETライブラリです。 それは、NuGet パッケージ マネージャー コンソールを使用して簡単にプロジェクトに追加でき、C# プロジェクトに容易に統合されます。
その際立った機能には以下が含まれます:
PDFsharpは、主に基本的なPDFの作成と操作のために設計された、無料のオープンソースライブラリです。 IronPDFが提供するリッチな機能セットはありませんが、複雑な機能を必要としないシンプルなプロジェクトには優れた選択肢です。 PDFsharpの主な機能には以下が含まれます:
基本的な暗号化: PDFドキュメントに基本的なパスワード保護を追加します。
🚨 主な制限事項: PDFsharp は HTML から PDF への変換にネイティブ対応しておらず、Polybioz.HtmlRenderer.PdfSharp.Core のようなサードパーティーツールが必要であり、これが複雑さを増します。
IronPDFは、クロスプラットフォーム設計で、.NET Core、.NET Framework、Azureと完全に互換性があり、Windows、macOS、Linuxをサポートしています。 これは複数のオペレーティングシステムで実行する必要のあるプロジェクトにとって理想的な選択となり、ほとんどの開発環境でライブラリが普遍的な互換性を持つことを保証します。 このライブラリは最新のウェブ開発環境とシームレスに統合されており、ウェブアプリケーション、クラウドソリューション、エンタープライズシステムに最適です。
PDFsharpは主に.NET Frameworkのために設計されており、.NET Coreのサポートは限られています。 .NET Coreバージョンもありますが、まだ進行中であり、一部の機能は非Windowsプラットフォーム向けに完全に最適化されていません。 LinuxおよびmacOSのユーザーは互換性の問題に直面する可能性があり、PDFsharpはクロスプラットフォームアプリケーションにはあまり理想的ではない選択肢です。
IronPDFは、PDFファイルを扱う際の複雑さを抽象化した開発者向けのAPIを提供します。 PDFの生成や既存ファイルの編集を問わず、文法はシンプルで直感的です。これにより、開発者は数行のコードで複雑な機能を実装することができます。
PDFsharpは、テキスト生成やPDF操作のような基本的なタスクに対して比較的使いやすいものの、複雑なドキュメントの生成や編集のようなタスクにはしばしばより多くの手動処理が必要です。
IronPDF: HTMLをPDFに変換
HTMLのスニペットやコンテンツを一つのメソッド呼び出しで簡単にPDFに変換します。
using IronPdf;
var renderer = new ChromePdfRenderer();
var content = "<h1>IronPDF Rocks!</h1>";
var pdf = renderer.RenderHtmlAsPdf(content);
pdf.SaveAs("output.pdf");
using IronPdf;
var renderer = new ChromePdfRenderer();
var content = "<h1>IronPDF Rocks!</h1>";
var pdf = renderer.RenderHtmlAsPdf(content);
pdf.SaveAs("output.pdf");
Imports IronPdf
Private renderer = New ChromePdfRenderer()
Private content = "<h1>IronPDF Rocks!</h1>"
Private pdf = renderer.RenderHtmlAsPdf(content)
pdf.SaveAs("output.pdf")
✔ 簡潔でクリーンなコード
既存のHTMLコンテンツからの簡単な変換
PDFsharp: テキストを使用したPDFの作成
PDFsharpは、グラフィックスオブジェクトを使用してテキストやコンテンツを描画するために手動での実装が必要です。
using PdfSharp.Pdf;
using PdfSharp.Drawing;
var document = new PdfDocument();
var page = document.AddPage();
var gfx = XGraphics.FromPdfPage(page);
var font = new XFont("Arial", 20, XFontStyleEx.Bold);
gfx.DrawString("Hello, PDFsharp!", font, XBrushes.Black, new XPoint(50, 100));
document.Save("output.pdf");
using PdfSharp.Pdf;
using PdfSharp.Drawing;
var document = new PdfDocument();
var page = document.AddPage();
var gfx = XGraphics.FromPdfPage(page);
var font = new XFont("Arial", 20, XFontStyleEx.Bold);
gfx.DrawString("Hello, PDFsharp!", font, XBrushes.Black, new XPoint(50, 100));
document.Save("output.pdf");
Imports PdfSharp.Pdf
Imports PdfSharp.Drawing
Private document = New PdfDocument()
Private page = document.AddPage()
Private gfx = XGraphics.FromPdfPage(page)
Private font = New XFont("Arial", 20, XFontStyleEx.Bold)
gfx.DrawString("Hello, PDFsharp!", font, XBrushes.Black, New XPoint(50, 100))
document.Save("output.pdf")
🚨 制限事項:
❌ 手動実装 – 要素を手動で配置する必要があります。
❌ レポート、請求書、またはスタイル付きコンテンツを生成するにはより複雑。
IronPDFは、HTMLレポート、ウェブページ、および動的コンテンツをCSS、JavaScript、埋め込み画像を維持しながらPDFに変換するのに優れています。 これにより、理想的になります:
Webページをキャプチャしてオフラインで使用するためのPDF化。
IronPDF コード例 – HTML ファイルを PDF 形式に変換:
using IronPdf;
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlFileAsPdf("example.html");
pdf.SaveAs("example.pdf");
using IronPdf;
ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlFileAsPdf("example.html");
pdf.SaveAs("example.pdf");
Imports IronPdf
Private renderer As New ChromePdfRenderer()
Private pdf As PdfDocument = renderer.RenderHtmlFileAsPdf("example.html")
pdf.SaveAs("example.pdf")
出力
ご覧の通り、IronPDFを使用すると、スタイル付きのHTMLファイルをわずか3行のコードでPDFドキュメントに変換することができ、オリジナルの品質やレイアウトを失うことはありませんでした! IronPDFがより多くのCSSを含むコンテンツをどのように処理するかを見たい場合は、このURLのコンテンツをPDFに変換する例を見てみましょうか?
using IronPdf;
ChromePdfRenderer renderer = new ChromePdfRenderer();
renderer.RenderingOptions.EnableJavaScript = true;
renderer.RenderingOptions.WaitFor.JavaScript(5000);
renderer.RenderingOptions.CssMediaType = IronPdf.Rendering.PdfCssMediaType.Print;
PdfDocument pdf = renderer.RenderUrlAsPdf("https://www.apple.com");
pdf.SaveAs("Apple.pdf");
using IronPdf;
ChromePdfRenderer renderer = new ChromePdfRenderer();
renderer.RenderingOptions.EnableJavaScript = true;
renderer.RenderingOptions.WaitFor.JavaScript(5000);
renderer.RenderingOptions.CssMediaType = IronPdf.Rendering.PdfCssMediaType.Print;
PdfDocument pdf = renderer.RenderUrlAsPdf("https://www.apple.com");
pdf.SaveAs("Apple.pdf");
Imports IronPdf
Private renderer As New ChromePdfRenderer()
renderer.RenderingOptions.EnableJavaScript = True
renderer.RenderingOptions.WaitFor.JavaScript(5000)
renderer.RenderingOptions.CssMediaType = IronPdf.Rendering.PdfCssMediaType.Print
Dim pdf As PdfDocument = renderer.RenderUrlAsPdf("https://www.apple.com")
pdf.SaveAs("Apple.pdf")
出力
ここでは、IronPDF の強力なレンダリング オプションを活用して、Web コンテンツを高品質の PDF に変換し、元の CSS および JavaScript コンテンツをすべて保持します。
PDFsharpはネイティブでHTMLからPDFへの変換をサポートしていません。 この機能が必要な場合、Html Rendererのようなサードパーティのライブラリを使用する必要があります。これにより、静的なレンダリングコードを使用してHTMLコンテンツをPDFドキュメントに変換することができます。 これらの制限のために、PDFsharp は通常、以下の目的に最適です:
プログラムによって定義されたコンテンツを含む請求書、契約書、レポート。
PDFsharp と HtmlRenderer の例:
using PdfSharp.Pdf;
using TheArtOfDev.HtmlRenderer.PdfSharp;
var document = new PdfSharpCore.Pdf.PdfDocument();
string htmlContent = File.ReadAllText("index.html");
PdfGenerator.AddPdfPages(document, htmlContent, PdfSharpCore.PageSize.A4);
document.Save("html-to-pdf-pdfsharp.pdf");
using PdfSharp.Pdf;
using TheArtOfDev.HtmlRenderer.PdfSharp;
var document = new PdfSharpCore.Pdf.PdfDocument();
string htmlContent = File.ReadAllText("index.html");
PdfGenerator.AddPdfPages(document, htmlContent, PdfSharpCore.PageSize.A4);
document.Save("html-to-pdf-pdfsharp.pdf");
Imports PdfSharp.Pdf
Imports TheArtOfDev.HtmlRenderer.PdfSharp
Private document = New PdfSharpCore.Pdf.PdfDocument()
Private htmlContent As String = File.ReadAllText("index.html")
PdfGenerator.AddPdfPages(document, htmlContent, PdfSharpCore.PageSize.A4)
document.Save("html-to-pdf-pdfsharp.pdf")
出力
HtmlRenderer アドオンのおかげで、ほとんどのHTMLコンテンツをPDFに変換し、オリジナルのスタイリングを大部分保持することができますが、よりCSS依存のコンテンツに関してはIronPDFとどのように比較できるでしょうか? ウェブコンテンツをPDFファイルに変換するプロセスを見てみましょう:
using PdfSharpCore.Pdf;
using TheArtOfDev.HtmlRenderer.PdfSharp;
using System.Net.Http;
using System.Threading.Tasks;
using System.IO;
public class Program
{
public static async Task Main(string[] args)
{
// Define the URL to fetch HTML content
string url = "https://www.example.com"; // Replace with the URL you want to convert
// Fetch HTML content from the URL
string htmlContent = await FetchHtmlFromUrl(url);
// Generate the PDF from the fetched HTML content
var document = new PdfSharpCore.Pdf.PdfDocument();
PdfGenerator.AddPdfPages(document, htmlContent, PdfSharpCore.PageSize.A4);
// Save the generated PDF to a file
document.Save("url-to-pdf-example.pdf");
System.Console.WriteLine("PDF created successfully!");
}
// Method to fetch HTML content from a URL
private static async Task<string> FetchHtmlFromUrl(string url)
{
using (HttpClient client = new HttpClient())
{
// Send GET request to fetch the HTML content of the URL
HttpResponseMessage response = await client.GetAsync(url);
if (response.IsSuccessStatusCode)
{
// Read the content as a string
string htmlContent = await response.Content.ReadAsStringAsync();
return htmlContent;
}
else
{
throw new Exception($"Failed to fetch content from URL. Status Code: {response.StatusCode}");
}
}
}
}
using PdfSharpCore.Pdf;
using TheArtOfDev.HtmlRenderer.PdfSharp;
using System.Net.Http;
using System.Threading.Tasks;
using System.IO;
public class Program
{
public static async Task Main(string[] args)
{
// Define the URL to fetch HTML content
string url = "https://www.example.com"; // Replace with the URL you want to convert
// Fetch HTML content from the URL
string htmlContent = await FetchHtmlFromUrl(url);
// Generate the PDF from the fetched HTML content
var document = new PdfSharpCore.Pdf.PdfDocument();
PdfGenerator.AddPdfPages(document, htmlContent, PdfSharpCore.PageSize.A4);
// Save the generated PDF to a file
document.Save("url-to-pdf-example.pdf");
System.Console.WriteLine("PDF created successfully!");
}
// Method to fetch HTML content from a URL
private static async Task<string> FetchHtmlFromUrl(string url)
{
using (HttpClient client = new HttpClient())
{
// Send GET request to fetch the HTML content of the URL
HttpResponseMessage response = await client.GetAsync(url);
if (response.IsSuccessStatusCode)
{
// Read the content as a string
string htmlContent = await response.Content.ReadAsStringAsync();
return htmlContent;
}
else
{
throw new Exception($"Failed to fetch content from URL. Status Code: {response.StatusCode}");
}
}
}
}
Imports PdfSharpCore.Pdf
Imports TheArtOfDev.HtmlRenderer.PdfSharp
Imports System.Net.Http
Imports System.Threading.Tasks
Imports System.IO
Public Class Program
Public Shared Async Function Main(ByVal args() As String) As Task
' Define the URL to fetch HTML content
Dim url As String = "https://www.example.com" ' Replace with the URL you want to convert
' Fetch HTML content from the URL
Dim htmlContent As String = Await FetchHtmlFromUrl(url)
' Generate the PDF from the fetched HTML content
Dim document = New PdfSharpCore.Pdf.PdfDocument()
PdfGenerator.AddPdfPages(document, htmlContent, PdfSharpCore.PageSize.A4)
' Save the generated PDF to a file
document.Save("url-to-pdf-example.pdf")
System.Console.WriteLine("PDF created successfully!")
End Function
' Method to fetch HTML content from a URL
Private Shared Async Function FetchHtmlFromUrl(ByVal url As String) As Task(Of String)
Using client As New HttpClient()
' Send GET request to fetch the HTML content of the URL
Dim response As HttpResponseMessage = Await client.GetAsync(url)
If response.IsSuccessStatusCode Then
' Read the content as a string
Dim htmlContent As String = Await response.Content.ReadAsStringAsync()
Return htmlContent
Else
Throw New Exception($"Failed to fetch content from URL. Status Code: {response.StatusCode}")
End If
End Using
End Function
End Class
出力
PDFsharpは、IronPDFのように同じ集中的なCSSおよびJavaScriptコンテンツを処理することはできませんが、CSSやJavaScriptコンテンツに依存しないPDF生成タスクのための軽量なPDFライブラリを探している人々にとって依然として強力な選択肢です。 HTML変換には追加のライブラリが必要ですが、PDFsharpは.NETエコシステム内でPDFファイルをゼロから作成することが可能です。
IronPDFは、特に厳格なデータ保護規則の遵守が必要なアプリケーションにおいて、安全なPDFの処理を必要とする開発者にとっての最適な選択肢です。 それは、PDF文書が安全で改ざん防止されるように設計された高度なセキュリティ機能を提供し、金融、医療、法律などの業界に適しています。
IronPDF のユースケース:
GDPRおよびHIPAAのコンプライアンス: 個人または機密情報を扱う際に、IronPDFはGDPRおよびHIPAAなどの規制を満たす暗号化標準をサポートし、安全なクライアントデータを扱う開発者に安心を提供します。
IronPDFの暗号化機能には、ユーザーレベルとオーナーレベルのパスワードが含まれており、PDFへのアクセスを制限したり、印刷、コピー、編集などの特定の操作を制限することができます。 さらに、デジタル署名をPDFに適用することができ、データの完全性と否認防止を確保するため、法的文書に最適です。 これらの機能は、文書のセキュリティが最重要となるワークフローで特に有用です。
IronPDF コード例 – パスワードでPDFを暗号化する:
using IronPdf;
var pdf = PdfDocument.FromFile("ConfidentialDocument.pdf");
pdf.SecuritySettings.UserPassword = "user";
pdf.SecuritySettings.OwnerPassword = "owner";
pdf.SecuritySettings.AllowUserEdits = IronPdf.Security.PdfEditSecurity.NoEdit;
pdf.SecuritySettings.AllowUserAnnotations = false;
pdf.SaveAs("ConfidentialDocumentSecured.pdf");
using IronPdf;
var pdf = PdfDocument.FromFile("ConfidentialDocument.pdf");
pdf.SecuritySettings.UserPassword = "user";
pdf.SecuritySettings.OwnerPassword = "owner";
pdf.SecuritySettings.AllowUserEdits = IronPdf.Security.PdfEditSecurity.NoEdit;
pdf.SecuritySettings.AllowUserAnnotations = false;
pdf.SaveAs("ConfidentialDocumentSecured.pdf");
Imports IronPdf
Private pdf = PdfDocument.FromFile("ConfidentialDocument.pdf")
pdf.SecuritySettings.UserPassword = "user"
pdf.SecuritySettings.OwnerPassword = "owner"
pdf.SecuritySettings.AllowUserEdits = IronPdf.Security.PdfEditSecurity.NoEdit
pdf.SecuritySettings.AllowUserAnnotations = False
pdf.SaveAs("ConfidentialDocumentSecured.pdf")
出力
この例では、IronPDFはPDFを暗号化してユーザーの操作を制限し、文書が不正アクセスや改ざんから守られることを保証します。
PDFsharpは基本的なパスワード保護を提供していますが、デジタル署名、透かし、または高度な暗号化のような高度な機能が欠けています。 PDFのアクセスを制限したり、基本的なパスワードを適用するだけの単純なユースケースには、PDFsharpが適しています。 しかし、あなたのアプリケーションが、セキュリティ基準を満たすための安全な文書署名や暗号化など、より高度なセキュリティ機能を必要とする場合、PDFsharpでは不十分かもしれません。
PDFsharp の使用例:
機密ファイルの基本的な暗号化: あなたのアプリケーションがコンプライアンス駆動のセキュリティを必要としない場合でも、未許可のユーザーが機密PDFを開かないように確実にしたいのであれば、PDFsharpのパスワード保護が簡単な解決策です。
しかし、PDFsharpの暗号化機能はIronPDFと比べて制限されており、強力なセキュリティが必要なシナリオには適していません。 ユーザーパスワードでPDFを保護し、印刷やコピーなどの特定の操作を制限できますが、金融や医療のような業界に必要な堅牢な暗号化標準は提供していません。
PDFsharp コード例 – 基本的なPDF暗号化:
using PdfSharp.Pdf;
using PdfSharp.Pdf.Security;
using PdfSharp.Drawing;
// Create new document
var document = new PdfSharp.Pdf.PdfDocument();
// Add a page and draw something on it
var page = document.AddPage();
var gfx = XGraphics.FromPdfPage(page);
var font = new XFont("Arial", 16, XFontStyleEx.Bold);
gfx.DrawString("Confidential Document", font, XBrushes.Black, new XPoint(50, 50));
// Set password protection
document.SecuritySettings.UserPassword = "password123";
document.SecuritySettings.OwnerPassword = "admin456";
// Save the encrypted PDF
document.Save("pdfsharp-encrypted.pdf");
using PdfSharp.Pdf;
using PdfSharp.Pdf.Security;
using PdfSharp.Drawing;
// Create new document
var document = new PdfSharp.Pdf.PdfDocument();
// Add a page and draw something on it
var page = document.AddPage();
var gfx = XGraphics.FromPdfPage(page);
var font = new XFont("Arial", 16, XFontStyleEx.Bold);
gfx.DrawString("Confidential Document", font, XBrushes.Black, new XPoint(50, 50));
// Set password protection
document.SecuritySettings.UserPassword = "password123";
document.SecuritySettings.OwnerPassword = "admin456";
// Save the encrypted PDF
document.Save("pdfsharp-encrypted.pdf");
Imports PdfSharp.Pdf
Imports PdfSharp.Pdf.Security
Imports PdfSharp.Drawing
' Create new document
Private document = New PdfSharp.Pdf.PdfDocument()
' Add a page and draw something on it
Private page = document.AddPage()
Private gfx = XGraphics.FromPdfPage(page)
Private font = New XFont("Arial", 16, XFontStyleEx.Bold)
gfx.DrawString("Confidential Document", font, XBrushes.Black, New XPoint(50, 50))
' Set password protection
document.SecuritySettings.UserPassword = "password123"
document.SecuritySettings.OwnerPassword = "admin456"
' Save the encrypted PDF
document.Save("pdfsharp-encrypted.pdf")
出力
このコードでは、PDFsharpはPDFドキュメントにユーザーパスワードを適用してアクセスを制限します。
IronPDFは、包括的なPDF編集、赤字修正、およびDOCXからPDFへの変換のような複数のファイル形式を処理する能力が求められるシナリオで際立っています。 高度なPDF操作が必要であり、ビジネスワークフローに簡単に統合できるアプリケーションを開発している開発者に最適です。
IronPDFの実際のユースケース:
編集可能なPDFフォーム: ユーザーがデータを入力できるインタラクティブなPDFフォーム(例: アプリケーション、アンケート、フィードバックフォーム)を作成する場合、IronPDFを使用すると、入力可能なフォームを作成および修正できます。 この機能は、人事、教育、カスタマーサポートなどの業界で一般的に使用されています。
使用例 – DOCXをPDFに変換し、ウォーターマークを追加する例: 企業環境では、IronPDFを使用してWord文書をPDFに変換し、その後ブランディングやセキュリティ目的でウォーターマークを追加することができます。 IronPDFを使用すると、ウォーターマークを指定したページやすべてのPDFページに適用できます。
ここでは、サンプルのDOCXファイルを取り、ドラフトとしてラベル付けするためにウォーターマークを適用し、例として会社のブランディングを行います。
using IronPdf;
using IronPdf.Editing;
DocxToPdfRenderer renderer = new DocxToPdfRenderer();
PdfDocument pdf = renderer.RenderDocxAsPdf("document.docx");
var watermark = "<h1 style='Color: red; font-size: 60px'>DRAFT</h1><img style='width: 200px' src='https://ironsoftware.com/img/products/ironpdf-logo-text-dotnet.svg'>";
pdf.ApplyWatermark(watermark, opacity:75, VerticalAlignment.Top, HorizontalAlignment.Right);
pdf.SaveAs("output.pdf");
using IronPdf;
using IronPdf.Editing;
DocxToPdfRenderer renderer = new DocxToPdfRenderer();
PdfDocument pdf = renderer.RenderDocxAsPdf("document.docx");
var watermark = "<h1 style='Color: red; font-size: 60px'>DRAFT</h1><img style='width: 200px' src='https://ironsoftware.com/img/products/ironpdf-logo-text-dotnet.svg'>";
pdf.ApplyWatermark(watermark, opacity:75, VerticalAlignment.Top, HorizontalAlignment.Right);
pdf.SaveAs("output.pdf");
Imports IronPdf
Imports IronPdf.Editing
Private renderer As New DocxToPdfRenderer()
Private pdf As PdfDocument = renderer.RenderDocxAsPdf("document.docx")
Private watermark = "<h1 style='Color: red; font-size: 60px'>DRAFT</h1><img style='width: 200px' src='https://ironsoftware.com/img/products/ironpdf-logo-text-dotnet.svg'>"
pdf.ApplyWatermark(watermark, opacity:=75, VerticalAlignment.Top, HorizontalAlignment.Right)
pdf.SaveAs("output.pdf")
出力
この例では、IronPDF はまず DOCX ドキュメント をPDFに変換し、次に ウォーターマーク を追加して、ドキュメントに 「ドラフト」 のラベルが付いていることを確認します。 この機能は、文書のセキュリティを確保しながら機密情報を配布する必要がある企業や、どの文書がドラフトであるかを追跡するために役立ちます。
PDFsharpは、軽量な編集やゼロからのドキュメント作成が必要な基本的なPDF操作により適しています。 それは、ゼロからシンプルなPDFを作成したり、既存のPDFを修正したり、基本的な編集を適用したりするようなタスクに優れています。 しかし、より複雑な操作、例えば高度な編集、文書の変換、フォームデータの操作などに関しては、PDFsharpの機能はIronPDFに比べて制限されています。
PDFsharpの実際の使用例:
基本的な墨消し: PDFsharpはIronPDFのような高度な墨消し機能を提供していませんが、形や単色でテキストや画像を覆うなどの基本的な墨消しに使用できます。 これは、低いセキュリティ要求の文書や、厳格なデータプライバシー法の遵守が求められないアプリケーションには十分である可能性があります。
使用例: ビジネス環境では、PDFsharp を使用して、データベースから抽出したデータからレポートを生成したり、複数のファイルを1つに結合したり、内部使用のために文書の一部を編集したりすることができます。
PDFsharp コード例 – 2 つの PDF のマージ:
using PdfSharp.Pdf;
using PdfSharp.Pdf.IO;
// Open the first PDF
PdfDocument document1 = PdfReader.Open("document1.pdf", PdfDocumentOpenMode.Import);
// Open the second PDF
PdfDocument document2 = PdfReader.Open("document2.pdf", PdfDocumentOpenMode.Import);
// Create a new PDF document for the merged file
PdfDocument outputDocument = new PdfDocument();
// Add pages from the first document
foreach (PdfPage page in document1.Pages)
{
outputDocument.AddPage(page);
}
// Add pages from the second document
foreach (PdfPage page in document2.Pages)
{
outputDocument.AddPage(page);
}
// Save the merged PDF
outputDocument.Save("merged-document.pdf");
using PdfSharp.Pdf;
using PdfSharp.Pdf.IO;
// Open the first PDF
PdfDocument document1 = PdfReader.Open("document1.pdf", PdfDocumentOpenMode.Import);
// Open the second PDF
PdfDocument document2 = PdfReader.Open("document2.pdf", PdfDocumentOpenMode.Import);
// Create a new PDF document for the merged file
PdfDocument outputDocument = new PdfDocument();
// Add pages from the first document
foreach (PdfPage page in document1.Pages)
{
outputDocument.AddPage(page);
}
// Add pages from the second document
foreach (PdfPage page in document2.Pages)
{
outputDocument.AddPage(page);
}
// Save the merged PDF
outputDocument.Save("merged-document.pdf");
Imports PdfSharp.Pdf
Imports PdfSharp.Pdf.IO
' Open the first PDF
Private document1 As PdfDocument = PdfReader.Open("document1.pdf", PdfDocumentOpenMode.Import)
' Open the second PDF
Private document2 As PdfDocument = PdfReader.Open("document2.pdf", PdfDocumentOpenMode.Import)
' Create a new PDF document for the merged file
Private outputDocument As New PdfDocument()
' Add pages from the first document
For Each page As PdfPage In document1.Pages
outputDocument.AddPage(page)
Next page
' Add pages from the second document
For Each page As PdfPage In document2.Pages
outputDocument.AddPage(page)
Next page
' Save the merged PDF
outputDocument.Save("merged-document.pdf")
出力
このコードは、PDFsharp を使用して 2つのPDF文書を1つに結合 する方法を示しています。 これは、複数のレポート、請求書、またはその他の文書を一つのPDFに結合する必要があるアプリケーションの一般的なユースケースです。
IronPDFとPDFsharpは、それぞれ異なる価格設定とライセンスのアプローチを提供しており、さまざまなニーズに対応しています。 IronPDFは永続ライセンスモデルを提供しており、PDFsharpはオープンソースで無料で使用できます。
IronPDFは永久ライセンスモデルを採用しており、ユーザーは年間更新と共に生涯アクセスを得られます。 段階的な価格設定を提供しており、使用量に基づいて個人、チーム、または企業のライセンスが含まれます。 無料トライアルが利用可能で、購入前にツールをテストすることができます。 商用ライセンスのユーザーは、技術サポートや機能のアップデートも受けられます。
PDFsharpはMITライセンスの下で無料であり、オープンソースであるため、個人および商業利用の両方に無料です。 しかし、プレミアムサポートを提供していないため、ユーザーはコミュニティフォーラムに頼って支援を受けることになります。 これは、小規模またはオープンソースのプロジェクトに適していますが、より複雑なニーズには外部の助けが必要な場合があります。
IronPDFは開発者サポートに優れており、詳細なドキュメントと複数のサポートチャネルを提供します。 PDFsharpとは異なり、IronPDFは統合プロセス全体を通して開発者を支援する構造化されたリソースを提供します。
IronPDFは、包括的なドキュメントを提供しており、ステップバイステップガイド、APIリファレンス、コードサンプルが含まれています。 技術的な問い合わせには専用のサポートチームが利用可能です。 さらに、オンラインのナレッジベースでは、トラブルシューティングの解決策や便利なヒントを提供しています。 エンタープライズ顧客向けに、優先サポートはより迅速な問題解決を保証します。
IronPDFはまた、活発な開発者コミュニティを育成しています。 ユーザーは、コミュニティフォーラムに参加して、質問をしたり、体験を共有したり、解決策を見つけたりできます。 さらに、チュートリアルやビデオガイドがユーザーの迅速なスタートをサポートします。 IronPDFはGitHubにもあり、コミュニティがバグを報告したり、機能を提案したりすることができます。
PDFsharp のサポートは主に GitHub リポジトリと Stack Overflow のようなコミュニティフォーラムから得られます。 開発者は問題を報告したり、解決策を閲覧したり、質問をすることができます。 しかし、ドキュメントは限られており、詳細なガイドや公式のチュートリアルはほとんどなく、開発者はコミュニティの貢献や試行錯誤に頼る必要があります。
公式サポートがないため、開発者はGitHubを通じてPDFsharpに貢献し、ドキュメントを改善したり、機能を追加したりできます。 ユーザー提供によるチュートリアルがあるものの、専用のサポートチームがいないため、トラブルシューティングに時間がかかる場合があります。
IronPDF と PDFsharp のどちらを選ぶかは、主にプロジェクトの要件に依存します。 IronPDFは、HTMLからPDFへの変換、強力な暗号化、強力なクロスプラットフォームサポートといった高度な機能を備えた強力で多機能なソリューションです。 それは、高品質なPDF操作、セキュリティ機能、および専用サポートを必要とする企業、エンタープライズ、開発者にとって理想的です。
一方で、PDFsharpは、高度な機能を必要としない簡単なプロジェクトのために、使いやすさと柔軟性を提供する堅実なオープンソースの選択肢であり、基本的なPDF作成と編集が可能です。
包括的な機能を備えたオールインワンのPDFソリューションをお探しの場合は、IronPDFをぜひご検討ください。 IronPDFは商用サポートと継続的なアップデートにより、開発ニーズに応じてスケールするように構築されており、PDFが効率的かつ安全に処理されることを保証します。 今日からIronPDFを試してみましょう、そしてそれがどのようにPDFのワークフローを効率化できるかを発見してください!