透かしなしで本番環境でテストしてください。
必要な場所で動作します。
30日間、完全に機能する製品をご利用いただけます。
数分で稼働させることができます。
製品トライアル期間中にサポートエンジニアリングチームへの完全アクセス
Accusoft PDFビューアは、HTMLからPDFへの変換機能やその他のPDF編集および操作タスクを.NET向けに提供します。 IronPDFは、C#プロジェクトにおいて、これらのタスクをプログラムによっても実行し、時間と労力を節約します。
それらを比較して、あなたのプロジェクトに最適なものを見つけましょう。
IronPDF は C# HTML to PDF ライブラリです。 これはエンジニアがHTML文字列、Webページ、URLなどのソースからPDFファイルを作成するというタスクを実行できるようにします。また、ウォーターマーク、ブックマーク、ヘッダーやフッターなどのプロパティも設定できます。さらに、複数のPDFファイルを一つに結合したり、PDFページを画像に変換したり、その逆も可能です。
開発用には無料で提供され、30日間のデプロイトライアルがあり、プロジェクトの本番稼働に対応しています。
このリンクからファイルプロジェクトをダウンロードできます。
PrizmDoc Viewerは、PDFファイルを操作し、それらを他の形式にリモートで変換するために使用されるREST APIです。 PrizmDocは、100以上の異なる形式のファイルをPDFに変換し、PDFをPNG、JPG、TIFF、およびSVGに変換することができます。 アプリケーションにさまざまな種類の電子署名オプションを含めるためにも使用できます。
IronPDF | PrizmDoc Viewer |
---|---|
Work with PDF files programmatically. | Work with PDF files programmatically. |
Supports .NET core with Window, Mac, or Linux. | Supports .NET Core using Window, Mac, or Linux. |
Works Locally | Sends Documents to a remote server. |
Work with or without using Asynchronous Programming. | Must use Asynchronous Programming using `System.Threading.Tasks`. |
Easily work offline once we install IronPF in our system. | Must connect with the internet to send the request to the PrizmDoc Viewer server (Cloud-hosted or self-hosted). |
Provides many predefined functions. | Provides some predefined functions. |
Often requires minimal lines of code. | Often requires many lines of code. |
Unlimited conversions per project in each license plan. | Limited number of transactions in each cloud-hosted license plan. |
Free for development with no time limit. | Only 300 transactions with trial. |
次の2つをインストールしてコードを比較しましょう。
プロジェクトにIronPDFをインストールするには2つの方法がありますが、どちらを採用しても違いはありません。
IronPDF.dllをダウンロードして、プロジェクトにその参照を追加してください。 その後、次の方法でIronPdf
の名前空間に簡単にアクセスできます:
using IronPdf;
今、IronPDFの提供されている関数やクラスに簡単にアクセスできます。
パッケージマネージャーコンソール:
パッケージ マネージャー コンソールを使用している場合は、次のコマンドを実行してください:
:ProductInstall
ソリューションのパッケージ管理:
NuGet パッケージ マネージャーの GUI を使用している場合は、検索バーで IronPDF
を参照してインストールします。
PrizmDoc Viewerには2つの部分があり、1つはPrizmDoc Server
というサーバーサイドで、これはRestful APIとして機能します。 もう一つは、APIを叩いてレスポンスを取得するプロジェクトです。
名前からわかるように、これはサーバーサイドアプリケーションであり、ドキュメントをリクエスト(入力)として基本情報を取得し、ドキュメントをPDFファイルに変換した後、変換されたPDFファイルをクライアントにレスポンス(出力)として送信します。 それは製品の技術的な核であり、ドキュメント処理および変換エンジンです。2つの異なる方法で使用できますが、どちらを採用してもプログラミング構造と技術は同じです。
セルフホスト:
このオプションでは、サーバーを手配する必要があり、PrizmDoc Serverをダウンロードしてインストールできます。WindowsでのPrizmDoc Serverのインストール方法については、詳細はこちらをご覧ください。
注意: 少なくとも32 GBのRAMと4コアのCPUが必要です。そうでない場合は、問題が生じる可能性があります。
クラウドホスト:
これはPrizmDoc Viewerのクラウドベースのサービスであり、サーバーを手配する必要はありません。 私たちはそれを比較に使用します。 これを行うには、アカウントを作成し、その後ホームページが開きます。 API key
を API Key
メニューからコピーできますが、後でその使い方を見ていきます。
まず最初に、PrizmDoc Viewerを使用してドキュメントをPDFファイルに変換する基本的な構造を見ていきます。そして、C#コンソールアプリケーション内でWebClient()
を使ってAccusoft server
と直接やり取りします。
注意: 以下の例は、PrizmDocがPDFファイルを処理する方法の概念的な理解を得るためのものです。 少し長いので、この例を飛ばして直接比較に進んでも問題ありません。
この例では、myWebpage.html
を sample.pdf
ファイルに変換します。
注: プロジェクトにNewtonsoft
ライブラリをインストールし、その参照を追加する必要があります。
まず、以下のライブラリをプロジェクトに追加してください:
using System;
using System.IO;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;//install Newtonsoft
using System;
using System.IO;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;//install Newtonsoft
Imports System
Imports System.IO
Imports System.Net
Imports System.Text
Imports System.Threading.Tasks
Imports Newtonsoft.Json.Linq 'install Newtonsoft
次に、公開変数Accusoft API Key
を作成し、次のようにAPIキーを貼り付けます:
static string ApiKey= "Your-API-KEY";
static string ApiKey= "Your-API-KEY";
IRON VB CONVERTER ERROR developers@ironsoftware.com
PrizmDoc Viewerを使用してPDFファイルを処理するには3つのステップがあります:
PrizmDocサーバーにファイルをアップロードします。
アップロードされたファイルを変換する。
PrizmDocサーバーから変換されたファイルをダウンロードする。
そうすることで、各ステップごとに別々の関数を作成します。
static void Main(string [] args)
{
//---Upload file to Server---
JObject uploadResults = UploadToServer("myWebpage.html").Result;
string fileID = (string)uploadResults.SelectToken("fileId");
string affinityToken = (string)uploadResults.SelectToken("affinityToken");
//---Convert the uploaded file to PDF---
JObject convertResults = Convert(affinityToken, fileID).Result;
string processId = (string)convertResults.SelectToken("processId");
affinityToken = (string)convertResults.SelectToken("affinityToken");
//---Check the status that conversion is completed---
JObject convertStatusresults = ConvertStatus(processId, affinityToken).Result;
string convertStatus = (string)convertResults.SelectToken("state");
//---Continuously checking whether conversion completed or not until completed---
while (!(convertStatus.Equals("complete")))
{
System.Threading.Thread.Sleep(30000);
convertStatusresults = ConvertStatus(processId, affinityToken).Result;
convertStatus = (string)convertStatusresults.SelectToken("state");
}
//---Download the converted file from server---
string newFileID = (string)convertStatusresults.SelectToken("output.results [0].fileId");
DownloadFromServer(affinityToken, newFileID, "sample.pdf").Wait();
Console.WriteLine("PDF file created successfully...!");
Console.ReadKey();
}
static void Main(string [] args)
{
//---Upload file to Server---
JObject uploadResults = UploadToServer("myWebpage.html").Result;
string fileID = (string)uploadResults.SelectToken("fileId");
string affinityToken = (string)uploadResults.SelectToken("affinityToken");
//---Convert the uploaded file to PDF---
JObject convertResults = Convert(affinityToken, fileID).Result;
string processId = (string)convertResults.SelectToken("processId");
affinityToken = (string)convertResults.SelectToken("affinityToken");
//---Check the status that conversion is completed---
JObject convertStatusresults = ConvertStatus(processId, affinityToken).Result;
string convertStatus = (string)convertResults.SelectToken("state");
//---Continuously checking whether conversion completed or not until completed---
while (!(convertStatus.Equals("complete")))
{
System.Threading.Thread.Sleep(30000);
convertStatusresults = ConvertStatus(processId, affinityToken).Result;
convertStatus = (string)convertStatusresults.SelectToken("state");
}
//---Download the converted file from server---
string newFileID = (string)convertStatusresults.SelectToken("output.results [0].fileId");
DownloadFromServer(affinityToken, newFileID, "sample.pdf").Wait();
Console.WriteLine("PDF file created successfully...!");
Console.ReadKey();
}
Shared Sub Main(ByVal args() As String)
'---Upload file to Server---
Dim uploadResults As JObject = UploadToServer("myWebpage.html").Result
Dim fileID As String = CStr(uploadResults.SelectToken("fileId"))
Dim affinityToken As String = CStr(uploadResults.SelectToken("affinityToken"))
'---Convert the uploaded file to PDF---
Dim convertResults As JObject = Convert(affinityToken, fileID).Result
Dim processId As String = CStr(convertResults.SelectToken("processId"))
affinityToken = CStr(convertResults.SelectToken("affinityToken"))
'---Check the status that conversion is completed---
Dim convertStatusresults As JObject = ConvertStatus(processId, affinityToken).Result
Dim convertStatus As String = CStr(convertResults.SelectToken("state"))
'---Continuously checking whether conversion completed or not until completed---
Do While Not (convertStatus.Equals("complete"))
System.Threading.Thread.Sleep(30000)
convertStatusresults = ConvertStatus(processId, affinityToken).Result
convertStatus = CStr(convertStatusresults.SelectToken("state"))
Loop
'---Download the converted file from server---
Dim newFileID As String = CStr(convertStatusresults.SelectToken("output.results [0].fileId"))
DownloadFromServer(affinityToken, newFileID, "sample.pdf").Wait()
Console.WriteLine("PDF file created successfully...!")
Console.ReadKey()
End Sub
1. サーバーにファイルをアップロード:
public static async Task<JObject> UploadToServer(string fileToUpload)
{
FileInfo input = new FileInfo(fileToUpload);
if (input == null)
{
throw new ArgumentException("Missing parameter input", "input");
}
var fileName = input.Name;
var endpoint = new Uri("https://api.accusoft.com/PCCIS/V1/WorkFile");
using (var client = new WebClient())
{
client.Headers.Add("acs-api-key", ApiKey);
client.Headers.Add("Content-Type", "application/octet-stream");
using (var reader = new BinaryReader(input.OpenRead()))
{
var data = reader.ReadBytes((int)reader.BaseStream.Length);
var results = await client.UploadDataTaskAsync(endpoint, "POST", data);
string getResult = "";
getResult = Encoding.ASCII.GetString(results);
return JObject.Parse(getResult);
}
}
}
public static async Task<JObject> UploadToServer(string fileToUpload)
{
FileInfo input = new FileInfo(fileToUpload);
if (input == null)
{
throw new ArgumentException("Missing parameter input", "input");
}
var fileName = input.Name;
var endpoint = new Uri("https://api.accusoft.com/PCCIS/V1/WorkFile");
using (var client = new WebClient())
{
client.Headers.Add("acs-api-key", ApiKey);
client.Headers.Add("Content-Type", "application/octet-stream");
using (var reader = new BinaryReader(input.OpenRead()))
{
var data = reader.ReadBytes((int)reader.BaseStream.Length);
var results = await client.UploadDataTaskAsync(endpoint, "POST", data);
string getResult = "";
getResult = Encoding.ASCII.GetString(results);
return JObject.Parse(getResult);
}
}
}
Public Shared Async Function UploadToServer(ByVal fileToUpload As String) As Task(Of JObject)
Dim input As New FileInfo(fileToUpload)
If input Is Nothing Then
Throw New ArgumentException("Missing parameter input", "input")
End If
Dim fileName = input.Name
Dim endpoint = New Uri("https://api.accusoft.com/PCCIS/V1/WorkFile")
Using client = New WebClient()
client.Headers.Add("acs-api-key", ApiKey)
client.Headers.Add("Content-Type", "application/octet-stream")
Using reader = New BinaryReader(input.OpenRead())
Dim data = reader.ReadBytes(CInt(reader.BaseStream.Length))
Dim results = Await client.UploadDataTaskAsync(endpoint, "POST", data)
Dim getResult As String = ""
getResult = Encoding.ASCII.GetString(results)
Return JObject.Parse(getResult)
End Using
End Using
End Function
2. アップロードされたファイルをPDFに変換する:
public static async Task<JObject> Convert(string affinityToken, string fileID)
{
var endpoint = new Uri("https://api.accusoft.com/v2/contentConverters");
using (var client = new WebClient())
{
client.Headers.Add("Content-Type", "application/json");
client.Headers.Add("acs-api-key", ApiKey);
client.Headers.Add("Accusoft-Affinity-Token", affinityToken);
JObject myJson =
new JObject(
new JProperty("input",
new JObject(
new JProperty("sources",
new JArray(
new JObject(
new JProperty("fileId", fileID)
)
)
),
new JProperty("dest",
new JObject(
new JProperty("format", "pdf")
)
)
)
)
);
string results = await client.UploadStringTaskAsync(endpoint, "POST", myJson.ToString());
return JObject.Parse(results);
}
}
public static async Task<JObject> Convert(string affinityToken, string fileID)
{
var endpoint = new Uri("https://api.accusoft.com/v2/contentConverters");
using (var client = new WebClient())
{
client.Headers.Add("Content-Type", "application/json");
client.Headers.Add("acs-api-key", ApiKey);
client.Headers.Add("Accusoft-Affinity-Token", affinityToken);
JObject myJson =
new JObject(
new JProperty("input",
new JObject(
new JProperty("sources",
new JArray(
new JObject(
new JProperty("fileId", fileID)
)
)
),
new JProperty("dest",
new JObject(
new JProperty("format", "pdf")
)
)
)
)
);
string results = await client.UploadStringTaskAsync(endpoint, "POST", myJson.ToString());
return JObject.Parse(results);
}
}
Public Shared Async Function Convert(ByVal affinityToken As String, ByVal fileID As String) As Task(Of JObject)
Dim endpoint = New Uri("https://api.accusoft.com/v2/contentConverters")
Using client = New WebClient()
client.Headers.Add("Content-Type", "application/json")
client.Headers.Add("acs-api-key", ApiKey)
client.Headers.Add("Accusoft-Affinity-Token", affinityToken)
Dim myJson As New JObject(New JProperty("input", New JObject(New JProperty("sources", New JArray(New JObject(New JProperty("fileId", fileID)))), New JProperty("dest", New JObject(New JProperty("format", "pdf"))))))
Dim results As String = Await client.UploadStringTaskAsync(endpoint, "POST", myJson.ToString())
Return JObject.Parse(results)
End Using
End Function
次のJSONは、myJson
オブジェクトの結果の値です。
{
"input": {
"sources":
[
{"fileId": "Auto Generated FileId Value"}
],
"dest": {
"format": "pdf"
}
}
}
変換が完了したかどうかステータスを確認
public static async Task<JObject> ConvertStatus(string processId, string affinityToken)
{
string endpoint = "https://api.accusoft.com/v2/contentConverters/" + processId;
using (var client = new WebClient())
{
client.BaseAddress = endpoint;
client.Headers.Add("acs-api-key", ApiKey);
client.Headers.Add("Accusoft-Affinity-Token", affinityToken);
string results = await client.DownloadStringTaskAsync(endpoint);
return JObject.Parse(results);
}
}
public static async Task<JObject> ConvertStatus(string processId, string affinityToken)
{
string endpoint = "https://api.accusoft.com/v2/contentConverters/" + processId;
using (var client = new WebClient())
{
client.BaseAddress = endpoint;
client.Headers.Add("acs-api-key", ApiKey);
client.Headers.Add("Accusoft-Affinity-Token", affinityToken);
string results = await client.DownloadStringTaskAsync(endpoint);
return JObject.Parse(results);
}
}
Public Shared Async Function ConvertStatus(ByVal processId As String, ByVal affinityToken As String) As Task(Of JObject)
Dim endpoint As String = "https://api.accusoft.com/v2/contentConverters/" & processId
Using client = New WebClient()
client.BaseAddress = endpoint
client.Headers.Add("acs-api-key", ApiKey)
client.Headers.Add("Accusoft-Affinity-Token", affinityToken)
Dim results As String = Await client.DownloadStringTaskAsync(endpoint)
Return JObject.Parse(results)
End Using
End Function
3. サーバーから変換されたファイルをダウンロード
public static async Task DownloadFromServer(string affinityToken, string fileId, string outfile)
{
var endpoint = new Uri("https://api.accusoft.com/PCCIS/V1/WorkFile/" + fileId);
using (var client = new WebClient())
{
client.Headers.Add("acs-api-key", ApiKey);
client.Headers.Add("Accusoft-Affinity-Token", affinityToken);
FileInfo output = new FileInfo(outfile);
using (var writeStream = output.Create())
{
var results = await client.DownloadDataTaskAsync(endpoint);
await writeStream.WriteAsync(results, 0, results.Length);
}
}
}
public static async Task DownloadFromServer(string affinityToken, string fileId, string outfile)
{
var endpoint = new Uri("https://api.accusoft.com/PCCIS/V1/WorkFile/" + fileId);
using (var client = new WebClient())
{
client.Headers.Add("acs-api-key", ApiKey);
client.Headers.Add("Accusoft-Affinity-Token", affinityToken);
FileInfo output = new FileInfo(outfile);
using (var writeStream = output.Create())
{
var results = await client.DownloadDataTaskAsync(endpoint);
await writeStream.WriteAsync(results, 0, results.Length);
}
}
}
Public Shared Async Function DownloadFromServer(ByVal affinityToken As String, ByVal fileId As String, ByVal outfile As String) As Task
Dim endpoint = New Uri("https://api.accusoft.com/PCCIS/V1/WorkFile/" & fileId)
Using client = New WebClient()
client.Headers.Add("acs-api-key", ApiKey)
client.Headers.Add("Accusoft-Affinity-Token", affinityToken)
Dim output As New FileInfo(outfile)
Using writeStream = output.Create()
Dim results = Await client.DownloadDataTaskAsync(endpoint)
Await writeStream.WriteAsync(results, 0, results.Length)
End Using
End Using
End Function
上記の例は多くの努力を要します! 作業負荷を最小限に抑えるために、Accusoft は Accusoft.PrizmDocServerSDK という .NET ライブラリを導入しました。これは PrizmDoc Server REST API をラップするものです。 このライブラリを.NETプロジェクトにインストールして使用する方法を見てみましょう。
ラッパーをインストールする方法は二つあります。
パッケージマネージャーコンソール:
次のコマンドを実行するには、パッケージマネージャーコンソールを使用してください:
:InstallCmd install-package Accusoft.PrizmDocServerSDK
ソリューションのパッケージ管理:
NuGet パッケージ マネージャーの GUI を使用している場合は、検索バーで Accusoft.PrizmDocServerSDK
を参照してインストールしてください。
これで、Accusoft.PrizmDocServer
名前空間に簡単にアクセスし、利用することができます。
using Accusoft.PrizmDocServer;
両方のコンポーネントの紹介とインストールを読んだ後、今度は両方のコンポーネントを使用する時です。 このために、いくつかのユースケースを取り上げ、両方のコンポーネントを使用して実装します。 これによってプログラミング構造の両方を簡単に理解し、プロジェクトに最適なものを決定する方法を提供できることを願っています。
最初の比較では、myWebPage.html
という名前のウェブページがあり、それをPDFファイルに変換してターゲットの場所に保存したいというユースケースを考えてみましょう。
/**
HTML to PDF
anchor-ironpdf-html-to-pdf
**/
using IronPdf;
static void Main(string [] args)
{
//create rendering converter
var converter = new ChromePdfRenderer();
//render html file to pdf
using var PDF = converter.RenderHTMLFileAsPdf("myWebPage.html");
//save to target location
PDF.SaveAs("sample.pdf");
}
/**
HTML to PDF
anchor-ironpdf-html-to-pdf
**/
using IronPdf;
static void Main(string [] args)
{
//create rendering converter
var converter = new ChromePdfRenderer();
//render html file to pdf
using var PDF = converter.RenderHTMLFileAsPdf("myWebPage.html");
//save to target location
PDF.SaveAs("sample.pdf");
}
'''
'''HTML to PDF
'''anchor-ironpdf-html-to-pdf
'''*
Imports IronPdf
Shared Sub Main(ByVal args() As String)
'create rendering converter
Dim converter = New ChromePdfRenderer()
'render html file to pdf
Dim PDF = converter.RenderHTMLFileAsPdf("myWebPage.html")
'save to target location
PDF.SaveAs("sample.pdf")
End Sub
上記のコードはsample.pdf
ファイルを作成し、プロジェクトのbin>debug
フォルダに保存します。
このようにパスを指定することもできます:PDF.SaveAs("E:/sample.pdf");
詳しく読む IronPDFを使用してPDFファイルを扱う方法について。
次に、比較を簡単にするために、PrizmDoc Viewerを使用して同じタスクを実行します。
PrizmDoc Viewerのインストールでは、すでにAccusoft API Key
の取得方法について説明しましたが、これからその使用方法を見ていきます。
まず、PrizmDocサーバーにリクエストを送り、サーバーからのレスポンスを受け取ります。 このプロセスには時間がかかるため、非同期プログラミングを使用する必要があります。
注意: PrizmDoc Viewerのクラウドサービスを使用してPDFファイルを作成する際は、システムがインターネットに接続されていることを確認してください。
using Accusoft.PrizmDocServer;
using Accusoft.PrizmDocServer.Conversion;
static void Main(string [] args)
{
ChromePdfRenderer().GetAwaiter().GetResult();
}
private static async Task ChromePdfRenderer()
{
//instantiate PrizmDocServerClient object
var prizmDocServer = new PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY");
// specify HTML file and convert it to a PDF.
ConversionResult result = await prizmDocServer.ConvertToPdfAsync("myWebPage.html");
// Save pdf file to the target location
await result.RemoteWorkFile.SaveAsync("sample.pdf");
}
using Accusoft.PrizmDocServer;
using Accusoft.PrizmDocServer.Conversion;
static void Main(string [] args)
{
ChromePdfRenderer().GetAwaiter().GetResult();
}
private static async Task ChromePdfRenderer()
{
//instantiate PrizmDocServerClient object
var prizmDocServer = new PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY");
// specify HTML file and convert it to a PDF.
ConversionResult result = await prizmDocServer.ConvertToPdfAsync("myWebPage.html");
// Save pdf file to the target location
await result.RemoteWorkFile.SaveAsync("sample.pdf");
}
Imports Accusoft.PrizmDocServer
Imports Accusoft.PrizmDocServer.Conversion
Shared Sub Main(ByVal args() As String)
ChromePdfRenderer().GetAwaiter().GetResult()
End Sub
Private Shared Async Function ChromePdfRenderer() As Task
'instantiate PrizmDocServerClient object
Dim prizmDocServer = New PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY")
' specify HTML file and convert it to a PDF.
Dim result As ConversionResult = Await prizmDocServer.ConvertToPdfAsync("myWebPage.html")
' Save pdf file to the target location
Await result.RemoteWorkFile.SaveAsync("sample.pdf")
End Function
PrizmDoc Viewer の操作方法について詳しく読む
以下の例から、IronPDFがPDFファイルを作成するためのより簡単なアプローチであり、それほど多くの時間を必要としないことがわかります。
この比較では、使用ケースとして、プロジェクトのdebug
フォルダーに存在する画像からPDFファイルを作成する必要があります。 IronPDFから始めましょう。
/**
Image to PDF
anchor-ironpdf-image-to-pdf
**/
using IronPdf;
static void Main(string [] args)
{
//specify the image to be convert
using var converted = ImageToPdfConverter.ImageToPdf("google.png");
//save PDF file to the target location
converted.SaveAs("sample.pdf");
}
/**
Image to PDF
anchor-ironpdf-image-to-pdf
**/
using IronPdf;
static void Main(string [] args)
{
//specify the image to be convert
using var converted = ImageToPdfConverter.ImageToPdf("google.png");
//save PDF file to the target location
converted.SaveAs("sample.pdf");
}
'''
'''Image to PDF
'''anchor-ironpdf-image-to-pdf
'''*
Imports IronPdf
Shared Sub Main(ByVal args() As String)
'specify the image to be convert
Dim converted = ImageToPdfConverter.ImageToPdf("google.png")
'save PDF file to the target location
converted.SaveAs("sample.pdf")
End Sub
出力:
このスクリーンショットは、上記のコードを使用して新たに作成されたPDFファイルsample.pdf
のものです。
IronPDF を使用して画像から PDF ファイルを作成するのがいかに簡単かを確認できます。 次に、PrizmDoc Viewerを使用して同じタスクを実行し、その生成されたPDFファイルを確認します。
static void Main(string [] args)
{
ImageToPDF().GetAwaiter().GetResult();
}
private static async Task ImageToPDF()
{
//instantiate PrizmDocServerClient object
var prizmDocServer = new PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY");
//specify the image to be convert
ConversionResult results = await prizmDocServer.ConvertToPdfAsync("google.png");
//save pdf file to the target location
await results.RemoteWorkFile.SaveAsync("sample.pdf");
}
static void Main(string [] args)
{
ImageToPDF().GetAwaiter().GetResult();
}
private static async Task ImageToPDF()
{
//instantiate PrizmDocServerClient object
var prizmDocServer = new PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY");
//specify the image to be convert
ConversionResult results = await prizmDocServer.ConvertToPdfAsync("google.png");
//save pdf file to the target location
await results.RemoteWorkFile.SaveAsync("sample.pdf");
}
Shared Sub Main(ByVal args() As String)
ImageToPDF().GetAwaiter().GetResult()
End Sub
Private Shared Async Function ImageToPDF() As Task
'instantiate PrizmDocServerClient object
Dim prizmDocServer = New PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY")
'specify the image to be convert
Dim results As ConversionResult = Await prizmDocServer.ConvertToPdfAsync("google.png")
'save pdf file to the target location
Await results.RemoteWorkFile.SaveAsync("sample.pdf")
End Function
出力: このスクリーンショットは、上記のコードから新しく作成されたPDFファイルsample.pdf
のものです。
私たちが見る限り、IronPDFを使用して2行の簡単なコードを書く必要があるだけです。 一方、PrizmDocサーバーを使用する場合は、非同期プログラミングを使って多くのコード行を記述する必要があります。 IronPDFの出力は、自動的に使用可能な全ページのドキュメントを提供します。
この比較において、A.pdf
、B.pdf
、C.pdf
という名前の3つのPDFファイルがあると仮定しましょう。 これらを1つのPDFファイルに統合したいと思いますが、このタスクは両方のコンポーネントを使用して実行できます。 まず、IronPDFを使用してこのタスクを実行する方法を確認します。
/**
Merge PDF Files
anchor-ironpdf-merge-pdf-files
**/
using IronPdf;
using System.Collections.Generic;
static void Main(string [] args)
{
//create rendering converter
var Renderer = new IronPdf.ChromePdfRenderer();
//create a list of pdf files
var PDFs = new List<PdfDocument>();
PDFs.Add(PdfDocument.FromFile("A.pdf"));
PDFs.Add(PdfDocument.FromFile("B.pdf"));
PDFs.Add(PdfDocument.FromFile("C.pdf"));
//merge the list of pdf file
using PdfDocument PDF = PdfDocument.Merge(PDFs);
//save merged file to the target location
PDF.SaveAs("sample.pdf");
foreach(var pdf in PDFs){
pdf.Dispose();
}
}
/**
Merge PDF Files
anchor-ironpdf-merge-pdf-files
**/
using IronPdf;
using System.Collections.Generic;
static void Main(string [] args)
{
//create rendering converter
var Renderer = new IronPdf.ChromePdfRenderer();
//create a list of pdf files
var PDFs = new List<PdfDocument>();
PDFs.Add(PdfDocument.FromFile("A.pdf"));
PDFs.Add(PdfDocument.FromFile("B.pdf"));
PDFs.Add(PdfDocument.FromFile("C.pdf"));
//merge the list of pdf file
using PdfDocument PDF = PdfDocument.Merge(PDFs);
//save merged file to the target location
PDF.SaveAs("sample.pdf");
foreach(var pdf in PDFs){
pdf.Dispose();
}
}
'''
'''Merge PDF Files
'''anchor-ironpdf-merge-pdf-files
'''*
Imports IronPdf
Imports System.Collections.Generic
Shared Sub Main(ByVal args() As String)
'create rendering converter
Dim Renderer = New IronPdf.ChromePdfRenderer()
'create a list of pdf files
Dim PDFs = New List(Of PdfDocument)()
PDFs.Add(PdfDocument.FromFile("A.pdf"))
PDFs.Add(PdfDocument.FromFile("B.pdf"))
PDFs.Add(PdfDocument.FromFile("C.pdf"))
'merge the list of pdf file
Using PDF As PdfDocument = PdfDocument.Merge(PDFs)
'save merged file to the target location
PDF.SaveAs("sample.pdf")
'INSTANT VB NOTE: The variable pdf was renamed since Visual Basic will not allow local variables with the same name as parameters or other local variables:
For Each .pdf_Conflict In PDFs
.pdf_Conflict.Dispose()
Next pdf_Conflict
End Using
End Sub
上記のコードは、A.pdf
、B.pdf
、C.pdf
の組み合わせであるsample.pdf
ファイルを作成します。
次に、PrizmDoc Viewerを使用して同じタスクを行います。
using System.Threading.Tasks;
using Accusoft.PrizmDocServer;
using Accusoft.PrizmDocServer.Conversion;
static void Main(string [] args)
{
PdfMerge().GetAwaiter().GetResult();
}
private static async Task PdfMerge()
{
//instantiate PrizmDocServerClient object
var prizmDocServer = new PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY");
//pass the list of pdf files to PrizmDoc Server
ConversionResult result = await prizmDocServer.CombineToPdfAsync(
new []{
new ConversionSourceDocument("A.pdf"),
new ConversionSourceDocument("B.pdf"),
new ConversionSourceDocument("C.pdf"),
});
//save merged file to the target location
await result.RemoteWorkFile.SaveAsync("sample.pdf");
}
using System.Threading.Tasks;
using Accusoft.PrizmDocServer;
using Accusoft.PrizmDocServer.Conversion;
static void Main(string [] args)
{
PdfMerge().GetAwaiter().GetResult();
}
private static async Task PdfMerge()
{
//instantiate PrizmDocServerClient object
var prizmDocServer = new PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY");
//pass the list of pdf files to PrizmDoc Server
ConversionResult result = await prizmDocServer.CombineToPdfAsync(
new []{
new ConversionSourceDocument("A.pdf"),
new ConversionSourceDocument("B.pdf"),
new ConversionSourceDocument("C.pdf"),
});
//save merged file to the target location
await result.RemoteWorkFile.SaveAsync("sample.pdf");
}
Imports System.Threading.Tasks
Imports Accusoft.PrizmDocServer
Imports Accusoft.PrizmDocServer.Conversion
Shared Sub Main(ByVal args() As String)
PdfMerge().GetAwaiter().GetResult()
End Sub
Private Shared Async Function PdfMerge() As Task
'instantiate PrizmDocServerClient object
Dim prizmDocServer = New PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY")
'pass the list of pdf files to PrizmDoc Server
Dim result As ConversionResult = Await prizmDocServer.CombineToPdfAsync({
New ConversionSourceDocument("A.pdf"),
New ConversionSourceDocument("B.pdf"),
New ConversionSourceDocument("C.pdf")
})
'save merged file to the target location
Await result.RemoteWorkFile.SaveAsync("sample.pdf")
End Function
上記のコードは、A.pdf
、B.pdf
、およびC.pdf
ファイルを組み合わせたsample.pdf
ファイルも作成します。
この比較では、myWebPage.html
という名前のシンプルなWebページがあり、次のHTMLとCSSを持っていると仮定しましょう。
<html>
<head>
<style>
li {
font-size:x-large;
color: rgba(156, 89, 13, 0.897);
list-style:square;
}
</style>
</head>
<body>
<h1 style="text-align: center;">Hello World..!</h1>
<h1>Main Menu</h1>
<ul>
<li>SubMenu 1</li>
<li>SubMenu 2</li>
<li>SubMenu 3</li>
<li>SubMenu 4</li>
<li>SubMenu 5</li>
</ul>
</body>
</html>
<html>
<head>
<style>
li {
font-size:x-large;
color: rgba(156, 89, 13, 0.897);
list-style:square;
}
</style>
</head>
<body>
<h1 style="text-align: center;">Hello World..!</h1>
<h1>Main Menu</h1>
<ul>
<li>SubMenu 1</li>
<li>SubMenu 2</li>
<li>SubMenu 3</li>
<li>SubMenu 4</li>
<li>SubMenu 5</li>
</ul>
</body>
</html>
このウェブページをPDFファイルに変換し、以下のヘッダーとフッターのプロパティを設定したいと思います:
DateTime
フッターの右側に総ページ数のページ番号
があります。
まず、IronPDFを使ってヘッダーとフッターを設定する方法について見ていきます。
PDFファイルのヘッダーとフッターを処理するために、IronPDFはChromePdfRenderer
クラスにRenderingOptions
というプロパティを提供しています。これは次のように使用できます:
ヘッダー用:
C# ChromePdfRenderer_Obj.RenderingOptions.TextHeader=new TextHeaderFooter()
フッター用:
C# ChromePdfRenderer_Obj.RenderingOptions.TextFooter=new TextHeaderFooter()
次のプロパティは、TextHeaderFooter()
を初期化する際に設定できます:
スペーシング は、ページの内容とヘッダーまたはフッターの間のスペースを調整します。
次のいくつかの事前定義された属性は、ヘッダーやフッターのコンテンツを設定するのに非常に役立ちます。 以下のように波括弧 { }
に書くことができます:
{pdf-title} はヘッダーまたはフッターにドキュメントのタイトルを印刷します。
詳細を読む IronPDFを使用してヘッダーとフッターを操作する方法について詳しく説明しています。
以下の例を見て、ユースケースを実装し、上記のプロパティを使用してPDFファイルのヘッダーとフッターを設定する方法を示しましょう。
/**
Set Header and Footer
anchor-ironpdf-pdf-header-and-footer
**/
using IronPdf;
static void Main(string [] args)
{
//create rendering converter
var converter = new ChromePdfRenderer();
//setting Header properties
converter.RenderingOptions.TextHeader = new TextHeaderFooter()
{
DrawDividerLine = true,
LeftText = "Page Title",
RightText = "{date} {time}",
FontSize = 13
};
//setting footer properties
converter.RenderingOptions.TextFooter = new TextHeaderFooter()
{
RightText = "Page {page} of {total-pages}",
FontSize = 12
};
//specify the file to be converted
using var PDF = converter.RenderHTMLFileAsPdf("myWebPage.html");
//save to target location
PDF.SaveAs("sample.pdf");
}
/**
Set Header and Footer
anchor-ironpdf-pdf-header-and-footer
**/
using IronPdf;
static void Main(string [] args)
{
//create rendering converter
var converter = new ChromePdfRenderer();
//setting Header properties
converter.RenderingOptions.TextHeader = new TextHeaderFooter()
{
DrawDividerLine = true,
LeftText = "Page Title",
RightText = "{date} {time}",
FontSize = 13
};
//setting footer properties
converter.RenderingOptions.TextFooter = new TextHeaderFooter()
{
RightText = "Page {page} of {total-pages}",
FontSize = 12
};
//specify the file to be converted
using var PDF = converter.RenderHTMLFileAsPdf("myWebPage.html");
//save to target location
PDF.SaveAs("sample.pdf");
}
'''
'''Set Header and Footer
'''anchor-ironpdf-pdf-header-and-footer
'''*
Imports IronPdf
Shared Sub Main(ByVal args() As String)
'create rendering converter
Dim converter = New ChromePdfRenderer()
'setting Header properties
converter.RenderingOptions.TextHeader = New TextHeaderFooter() With {
.DrawDividerLine = True,
.LeftText = "Page Title",
.RightText = "{date} {time}",
.FontSize = 13
}
'setting footer properties
converter.RenderingOptions.TextFooter = New TextHeaderFooter() With {
.RightText = "Page {page} of {total-pages}",
.FontSize = 12
}
'specify the file to be converted
Dim PDF = converter.RenderHTMLFileAsPdf("myWebPage.html")
'save to target location
PDF.SaveAs("sample.pdf")
End Sub
出力:上記のコードによって新しく作成されたPDFファイルsample.pdf
のスクリーンショット:
IronPDF を使用して PDF ファイルを作成する際に、ヘッダーとフッターを直感的な言語で簡単に操作できることがわかります。 次に、HeaderおよびFooterを設定するためにPrizmDoc Viewerを使用する方法を見てみましょう。
PrizmDoc Viewerは、HeaderFooterOptions
クラスを提供してヘッダーとフッターを扱います。以下のプロパティがあります:
行 ヘッダーおよびフッターの行を指定します(次の例を理解するとより明確になります)。各行には次のプロパティがあります:
左 は、ヘッダーまたはフッター行の左側にテキストを印刷します。
カラー ヘッダーまたはフッターテキストの色を指定します。
詳細を読む PrizmDocサーバーを使用してPDFページのヘッダーとフッターを設定する方法について。
上記のプロパティを使用して、どのようにユースケースを実装するか見てみましょう。
using System.Threading.Tasks;
using System.Collections.Generic;
using Accusoft.PrizmDocServer;
using Accusoft.PrizmDocServer.Conversion;
static void Main(string [] args)
{
SetHeaderFooter().GetAwaiter().GetResult();
}
private static async Task SetHeaderFooter()
{
//instantiate PrizmDocServerClient object with Header and footer properties
var prizmDocServer = new PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY");
ConversionResult result = await prizmDocServer.ConvertToPdfAsync(
"myWebPage.html",
header: new HeaderFooterOptions
{
Lines = new List<HeaderFooterLine>
{
new HeaderFooterLine { Left = "Page Title", Right = DateTime.Now.ToString() }
},
},
footer: new HeaderFooterOptions
{
Lines = new List<HeaderFooterLine>
{
new HeaderFooterLine { Right = "Page {{pageNumber}} of {{pageCount}}" },
},
});
//save to the target location
await result.RemoteWorkFile.SaveAsync("sample.pdf");
}
using System.Threading.Tasks;
using System.Collections.Generic;
using Accusoft.PrizmDocServer;
using Accusoft.PrizmDocServer.Conversion;
static void Main(string [] args)
{
SetHeaderFooter().GetAwaiter().GetResult();
}
private static async Task SetHeaderFooter()
{
//instantiate PrizmDocServerClient object with Header and footer properties
var prizmDocServer = new PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY");
ConversionResult result = await prizmDocServer.ConvertToPdfAsync(
"myWebPage.html",
header: new HeaderFooterOptions
{
Lines = new List<HeaderFooterLine>
{
new HeaderFooterLine { Left = "Page Title", Right = DateTime.Now.ToString() }
},
},
footer: new HeaderFooterOptions
{
Lines = new List<HeaderFooterLine>
{
new HeaderFooterLine { Right = "Page {{pageNumber}} of {{pageCount}}" },
},
});
//save to the target location
await result.RemoteWorkFile.SaveAsync("sample.pdf");
}
Imports System.Threading.Tasks
Imports System.Collections.Generic
Imports Accusoft.PrizmDocServer
Imports Accusoft.PrizmDocServer.Conversion
Shared Sub Main(ByVal args() As String)
SetHeaderFooter().GetAwaiter().GetResult()
End Sub
Private Shared Async Function SetHeaderFooter() As Task
'instantiate PrizmDocServerClient object with Header and footer properties
Dim prizmDocServer = New PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY")
Dim result As ConversionResult = Await prizmDocServer.ConvertToPdfAsync("myWebPage.html", header:= New HeaderFooterOptions With {.Lines = New List(Of HeaderFooterLine) _
From {
New HeaderFooterLine With {
.Left = "Page Title",
.Right = DateTime.Now.ToString()
}
}
},
footer:= New HeaderFooterOptions With {
.Lines = New List(Of HeaderFooterLine) From {
New HeaderFooterLine With {.Right = "Page {{pageNumber}} of {{pageCount}}"}
}
})
'save to the target location
Await result.RemoteWorkFile.SaveAsync("sample.pdf")
End Function
出力:
上記のコードによって作成された新しいPDFファイルのスクリーンショット:
IronPDFは、PrizmDoc Viewerと比較して、ヘッダーおよびフッターのプロパティを設定するための機能をシンプルなプログラミング構造でより多く提供していることがわかります。 IronPDFで生成されたPDFファイルは、PrizmDoc Viewerで生成されたファイルよりも読みやすく魅力的であるとされています。
別のユースケースを考えてみましょう。Sample_PDF.pdf
という名前のシンプルなPDFファイルがあり、これは2ページだけです。
そして、各ページの画像を作成する必要があります。 まず、IronPDFを使用してこのタスクを実行する方法を確認します。
/**
PDF to Image
anchor-ironpdf-convert-pdf-to-image
**/
using IronPdf;
static void Main(string [] args)
{
//specify file to be converted
var pdf = PdfDocument.FromFile("Sample_PDF.pdf");
//save images to the target location
pdf.RasterizeToImageFiles("image_*.png");
}
/**
PDF to Image
anchor-ironpdf-convert-pdf-to-image
**/
using IronPdf;
static void Main(string [] args)
{
//specify file to be converted
var pdf = PdfDocument.FromFile("Sample_PDF.pdf");
//save images to the target location
pdf.RasterizeToImageFiles("image_*.png");
}
'''
'''PDF to Image
'''anchor-ironpdf-convert-pdf-to-image
'''*
Imports IronPdf
Shared Sub Main(ByVal args() As String)
'specify file to be converted
Dim pdf = PdfDocument.FromFile("Sample_PDF.pdf")
'save images to the target location
pdf.RasterizeToImageFiles("image_*.png")
End Sub
出力:
上記のコードは、以下の2つの.png
画像を作成します。
IronPDFを使用して各PDFページの画像を作成するのが非常に簡単であることがわかります。 次に、PrizmDoc Viewerを使用して同じタスクを行います。
using System.Linq;
using System.Collections.Generic;
using System.Threading.Tasks;
using Accusoft.PrizmDocServer;
using Accusoft.PrizmDocServer.Conversion;
static void Main(string [] args)
{
PdfToImage().GetAwaiter().GetResult();
}
private static async Task PdfToImage()
{
//instantiate PrizmDocServerClient object
var prizmDocServer = new PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY");
//convert PDF file to images
IEnumerable<ConversionResult> results = await PrizmDocServer.ConvertAsync("Sample_PDF.pdf", DestinationFileFormat.Png);
//Save each image.
for (int i = 0; i < results.Count(); i++)
{
await results.ElementAt(i).RemoteWorkFile.SaveAsync($"page-{i + 1}.png");
}
}
using System.Linq;
using System.Collections.Generic;
using System.Threading.Tasks;
using Accusoft.PrizmDocServer;
using Accusoft.PrizmDocServer.Conversion;
static void Main(string [] args)
{
PdfToImage().GetAwaiter().GetResult();
}
private static async Task PdfToImage()
{
//instantiate PrizmDocServerClient object
var prizmDocServer = new PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY");
//convert PDF file to images
IEnumerable<ConversionResult> results = await PrizmDocServer.ConvertAsync("Sample_PDF.pdf", DestinationFileFormat.Png);
//Save each image.
for (int i = 0; i < results.Count(); i++)
{
await results.ElementAt(i).RemoteWorkFile.SaveAsync($"page-{i + 1}.png");
}
}
Imports System.Linq
Imports System.Collections.Generic
Imports System.Threading.Tasks
Imports Accusoft.PrizmDocServer
Imports Accusoft.PrizmDocServer.Conversion
Shared Sub Main(ByVal args() As String)
PdfToImage().GetAwaiter().GetResult()
End Sub
Private Shared Async Function PdfToImage() As Task
'instantiate PrizmDocServerClient object
Dim prizmDocServer = New PrizmDocServerClient("https://api.accusoft.com", "Your-API-KEY")
'convert PDF file to images
Dim results As IEnumerable(Of ConversionResult) = Await PrizmDocServer.ConvertAsync("Sample_PDF.pdf", DestinationFileFormat.Png)
'Save each image.
For i As Integer = 0 To results.Count() - 1
Await results.ElementAt(i).RemoteWorkFile.SaveAsync($"page-{i + 1}.png")
Next i
End Function
出力:
上記のコードは、次の2つの.png
画像も作成します:
PrizmDoc Viewerと比較して、IronPDFを使用すると、ページを繰り返し処理することなく、最小限のコード行数で各ページの画像を簡単に作成できます。
上記の比較では、両方のコンポーネントの技術的な構造と提供される機能を確認できます。 それでは、両方のコンポーネントのライセンス料金について見ていきましょう。 私たちは常に予算を最小限に抑えながら要件を満たすことを目指しているため、これは非常に重要です。
IronPDFのライセンスは、1人の開発者による単一プロジェクト用で$749から開始されます。
あなたが企業または複数のクライアントにサービスを提供する代理店のエンジニアである場合、ライセンスは$699から開始し、チームの規模やプロジェクトの数に応じて調整可能です。
以下のライセンスは一回限りの支払いが必要です。
Number of Developers | Price |
---|---|
1-5 | $699 |
6-10 | $799 |
11-20 | $899 |
21-50 | $999 |
Unlimited | $1,199 |
ロイヤリティフリーのOEM再配布のためのライセンスは$1599から始まります。
注: 上記のすべてのライセンスパッケージには、1年間のサポートとアップデートが含まれています。
詳細を読む IronPDFのすべてのライセンスパッケージについて。
サーバーを管理している場合、ライセンスの価格は年額 $7,900で標準サポートが含まれます。
詳細はこちら をご覧ください。PrizmDoc Viewerのすべての提供パッケージ情報について。
このライセンスは、トランザクションの数に基づいてスケーリングされるPrizmDoc Viewerのクラウドベースのサービスを対象としています。
用語:
Transaction
は、PrizmDoc Viewerサーバーにリクエストを送信し、出力(生成されたドキュメント)を取得することを意味します。
Prepaid Buckets
は、一度支払うことで取引を取得でき、それは期限切れになりません。
No of Transactions | Prepaid Buckets | Monthly | Annually |
---|---|---|---|
200 | $18 | ||
1,000 | $89 | ||
2,000 | $119 | ||
6,000 | $254 | $169 | $1,859 (6,000 Transactions/Month) |
12,000 | $434 | $289 | $3,179 (12,000 Transactions/Month) |
25,000 | $749 | $749 | $5,459 (25,000 Transactions/Month) |
50,000 | $1,199 | $799 | $8,789 (50,000 Transactions/Month) |
100,000 | $1,499 | $999 | $10,989 (100,000 Transactions/Month) |
200,000 | $2,549 | $1,699 | $19,188 (200,000 Transactions/Month) |
300,000 | $3,299 | $2,199 | $25,188 (300,000 Transactions/Month |
400,000 | $4,049 | $2,699 | $31,188 (400,000 Transactions/Month) |
500,000 | $4,799 | $3,199 | $37,188 (500,000 Transactions/Month) |
私たちは、.NETでのPDF開発を簡単にするための無料PDFリソースガイドを作成しました。このガイドには、共通の機能のチュートリアルや、C#およびVB.NETでPDFを操作、編集、生成、保存するための例が含まれています。
ガイドをダウンロードIronPDF C# ライブラリのAPIリファレンスを探索し、IronPDFのすべての機能、クラス、メソッドフィールド、名前空間、および列挙型の詳細を確認してください。
APIリファレンスを表示