製品比較

IronPDFとGroupDocsの比較 概要: IronPDFとGroupDocsは、両方ともPDF操作のための強力なツールを提供します。しかし、これらのツールにはそれぞれ異なる強みがあります。以下に、これらのツールを比較して、それぞれの特徴と利点を明確にします。 1. 機能性: IronPDFはPDFの作成、編集、変換機能に優れています。特に、HTMLからPDFへの変換や、.NET環境での利用が容易です。一方、GroupDocsはドキュメントの閲覧、注釈、比較機能に強みがあります。 2. サポートされるフォーマット: IronPDFは主にPDFへの操作に焦点を当てています。GroupDocsは、Word、Excel、PowerPointなど、多くの異なるドキュメントフォーマットをサポートします。 3. 開発環境: IronPDFは.NET、Java、Python、Node.jsなどの開発環境に対応しています。GroupDocsも多数のプラットフォームに対応していますが、特定のプラットフォームに制約があります。 4. 使いやすさ: IronPDFのシンプルで直感的なAPIは、初心者から経験豊富な開発者まで、幅広いユーザーに対応します。GroupDocsも直感的なインターフェースを提供していますが、セットアップには若干の学習曲線があります。 結論: IronPDFとGroupDocsの両方が各自のニーズに応じた優れたツールを提供しています。特定の機能や環境に依存してツールを選ぶことが重要です。初心者向けの簡便さとPDF操作に特化したい場合はIronPDFが適しています。複数のドキュメントフォーマットを扱いたい場合はGroupDocsが良い選択となるでしょう。

更新済み 11月 15, 2022
共有:

GroupDocsとIronPDFは、両方ともエンジニアにドキュメント自動化のためのツールを提供するクロスプラットフォームアプリケーションです。 彼らはPDFドキュメントを作成、編集、フォーマット、および印刷することができます。これは今日使用されている人気のあるドキュメント形式の1つです。 .NET および .NET Core を使用してプロジェクトを構築する際、開発者はプロジェクトに最適なツールを選択する必要があります。

開発者は利用可能なライブラリとツールについてよく理解している必要があります。 PDFライブラリも例外ではありません。 それぞれのツールには独自の強みと弱みがあるため、どのツールがビジネスおよびプロジェクトに最も適しているかを判断するのは開発者次第です。

この記事では、.NETおよび.NET Core開発者向けの最も人気のあるPDFライブラリ2つを比較します。 これらの2つのライブラリは:

  • グループドックス

    IronPDF

IronPDFとは何ですか?

IronPDFは、.NETプラットフォーム向けのC#ベースの商用PDF作成パッケージです。 それはHTML、CSS、画像、JavaScriptからPDFを生成します。 それはWebアプリケーション、セキュアなイントラネット、コンソールアプリ、WPFアプリ、およびMVCパターンのウェブサイトにおいて同様にうまく機能します。

IronPDFは、バージョン4から開始するすべての.NET Frameworkおよび.NET Coreプロジェクトと互換性があります。

GroupDocsライブラリとは何ですか?

GroupDocs.Editor APIはクロスプラットフォームの.NETライブラリで、開発者が人気のHTMLエディタと簡単にインターフェースできるシンプルなアプリケーションを作成することを可能にします。 (無料および有料) さまざまなファイル形式のドキュメントを変換、編集、操作します。

開発者はGroupDocs.Editorを使用してドキュメントを読み込み、HTMLに変換し、外部エディターにHTMLを送り、それを元の形式に戻して保存できます。 また、APIは編集者内のドキュメントにリンクされたリソースにアクセスすることができます。 それは、Microsoft Word、Microsoft Excel、OpenDocument、テキスト、ウォーターマークなど、多くのウェブおよびワードプロセッシングファイル形式をサポートしています。

これらの2つのライブラリを区別するものは何ですか? 調べてみましょう。

PDFドキュメントに注釈を付ける

グループドックスアノテーション

GroupDocs.Annotation for .NETは、開発者がC#、ASP.NET、その他の.NET技術でドキュメント注釈機能を実行できるアプリを作成できるようにします。 このライブラリがサポートするドキュメント注釈には、形状と矢印の描画、ポイントとコールアウトバブルの配置、テキストや画像の追加、コメントとハイライトの挿入、テキストや画像の取り消し線や下線の引き、その他が含まれます。 GroupDocs.Annotationは文書の注釈も操作できます。

ドキュメントに注釈を付けた後、ライブラリはドキュメントを元のファイル形式で保存できます。 強力なドキュメント注釈ツールは、PDFファイル、HTMLファイル、Word文書、Excelスプレッドシート、PowerPointプレゼンテーション、Visioファイル、CAD図面、画像フォーマットなどに注釈を追加することができます。

// Initialize list of AnnotationInfo
List<AnnotationInfo> annotations = new List<AnnotationInfo>();
// Initialize text annotation
AnnotationInfo textAnnotation = new AnnotationInfo
{
  Box = new Rectangle((float)265.44, (float)153.86, 206, 36), Type = AnnotationType.Text
};
// Add annotation to list
annotations.Add(textAnnotation);
// Get input file stream
Stream inputFile = new FileStream("D:/input.pdf", FileMode.Open, File
.ReadWrite);
// Export annotation and savthe e output file
CommonUtilities.SaveOutputDocument(inputFile, annotations, DocumentType.Pdf);
// Initialize list of AnnotationInfo
List<AnnotationInfo> annotations = new List<AnnotationInfo>();
// Initialize text annotation
AnnotationInfo textAnnotation = new AnnotationInfo
{
  Box = new Rectangle((float)265.44, (float)153.86, 206, 36), Type = AnnotationType.Text
};
// Add annotation to list
annotations.Add(textAnnotation);
// Get input file stream
Stream inputFile = new FileStream("D:/input.pdf", FileMode.Open, File
.ReadWrite);
// Export annotation and savthe e output file
CommonUtilities.SaveOutputDocument(inputFile, annotations, DocumentType.Pdf);
' Initialize list of AnnotationInfo
Dim annotations As New List(Of AnnotationInfo)()
' Initialize text annotation
Dim textAnnotation As New AnnotationInfo With {
	.Box = New Rectangle(CSng(265.44), CSng(153.86), 206, 36),
	.Type = AnnotationType.Text
}
' Add annotation to list
annotations.Add(textAnnotation)
' Get input file stream
Dim inputFile As Stream = New FileStream("D:/input.pdf", FileMode.Open, File.ReadWrite)
' Export annotation and savthe e output file
CommonUtilities.SaveOutputDocument(inputFile, annotations, DocumentType.Pdf)
VB   C#

IronPDF (アイアンPDF)

ユーザーは、IronPdf.PdfDocument.AddTextAnnotation メソッドおよび PdfDocument.TextAnnotation クラスの両方を使用して、IronPDFを用いてプログラム的にPDFドキュメントに注釈を追加することができます。

using PdfDocument Pdf = PdfDocument.FromFile("existing.pdf");// Create a PDF annotation object
var Annotation = new IronPdf.Annotations.TextAnnotation()
{
    Title = "This is the major title",
    Subject = "This is a subtitle",
    Contents = "This is the long 'sticky note' comment content...",
    Icon = IronPdf.Annotations.TextAnnotation.AnnotationIcon.Help,
    Opacity = 0.9,
    Printable = false,
    Hidden = false,
    OpenByDefault = true,
    ReadOnly = false,
    Rotateable = true
};

// Add the annotation "sticky note" to a specific page and location within any new or existing PDF.
Pdf.AddTextAnnotation(Annotation, 1, 150, 250);
Pdf.SaveAs("existing.pdf");
using PdfDocument Pdf = PdfDocument.FromFile("existing.pdf");// Create a PDF annotation object
var Annotation = new IronPdf.Annotations.TextAnnotation()
{
    Title = "This is the major title",
    Subject = "This is a subtitle",
    Contents = "This is the long 'sticky note' comment content...",
    Icon = IronPdf.Annotations.TextAnnotation.AnnotationIcon.Help,
    Opacity = 0.9,
    Printable = false,
    Hidden = false,
    OpenByDefault = true,
    ReadOnly = false,
    Rotateable = true
};

// Add the annotation "sticky note" to a specific page and location within any new or existing PDF.
Pdf.AddTextAnnotation(Annotation, 1, 150, 250);
Pdf.SaveAs("existing.pdf");
Using Pdf As PdfDocument = PdfDocument.FromFile("existing.pdf") ' Create a PDF annotation object
	Dim Annotation = New IronPdf.Annotations.TextAnnotation() With {
		.Title = "This is the major title",
		.Subject = "This is a subtitle",
		.Contents = "This is the long 'sticky note' comment content...",
		.Icon = IronPdf.Annotations.TextAnnotation.AnnotationIcon.Help,
		.Opacity = 0.9,
		.Printable = False,
		.Hidden = False,
		.OpenByDefault = True,
		.ReadOnly = False,
		.Rotateable = True
	}
	
	' Add the annotation "sticky note" to a specific page and location within any new or existing PDF.
	Pdf.AddTextAnnotation(Annotation, 1, 150, 250)
	Pdf.SaveAs("existing.pdf")
End Using
VB   C#

IronPDF のテキスト注釈機能には、色の追加/変更、要素のサイズ変更、不透明度の設定、シンボルの追加、およびテキストの編集が含まれます。

ファイル形式の変換

特定のファイル形式からPDFへの変換は、ファイルの整合性を維持するための重要な側面です。 両方のソフトウェアソリューションが異なる変換をどのように実行するか見てみましょう。

GroupDocsを使用したファイルのPDF変換

MS Word、Excel、PowerPoint、Visioなどのドキュメントタイプは、GroupDocs の GroupDocs.Conversion API を使用して変換できます。 GroupDocs.Conversionは、高速を必要とするサーバー側アプリケーション向けに設計されたスタンドアロンAPIです。 生産性ソフトウェアスイート(Microsoft OfficeやOpen Officeなど)に依存しません。

C#でXLSBをPDFに変換

XLSBファイル (Excelバイナリファイル形式) は、ExcelワークブックのデータをXMLではなくバイナリとして保存するファイル形式です。 (Excel XLSXファイルタイプの場合と同様に).

以下のサンプルコードは、C#でXLSBをPDFに変換します。

using System;
using GroupDocs.Conversion.Options.Convert;
namespace ConvertXlsbToPdfInCSharp
{
    class Program
    {
        public static void Main(string [] args) // Main function to convert XLSB to PDF using C#
        {
            // Remove the watermathe rk in output PDF document by adding license
            string licensePath = "GroupDocs.Conversion.lic";
            GroupDocs.Conversion.License lic = new GroupDocs.Conversion.License();
            lic.SetLicense(licensePath);

            // Load the source XLSB file for conversion to PDF
            var converter = new GroupDocs.Conversion.Converter("sample.xlsb");

            // Set convert options for the PDF document
            var convertOptions = new PdfConvertOptions();

            // Convert and save the XLSB in PDF format
            converter.Convert("converted.pdf", convertOptions);
            Console.WriteLine("Done");
        }
    }
}
using System;
using GroupDocs.Conversion.Options.Convert;
namespace ConvertXlsbToPdfInCSharp
{
    class Program
    {
        public static void Main(string [] args) // Main function to convert XLSB to PDF using C#
        {
            // Remove the watermathe rk in output PDF document by adding license
            string licensePath = "GroupDocs.Conversion.lic";
            GroupDocs.Conversion.License lic = new GroupDocs.Conversion.License();
            lic.SetLicense(licensePath);

            // Load the source XLSB file for conversion to PDF
            var converter = new GroupDocs.Conversion.Converter("sample.xlsb");

            // Set convert options for the PDF document
            var convertOptions = new PdfConvertOptions();

            // Convert and save the XLSB in PDF format
            converter.Convert("converted.pdf", convertOptions);
            Console.WriteLine("Done");
        }
    }
}
Imports System
Imports GroupDocs.Conversion.Options.Convert
Namespace ConvertXlsbToPdfInCSharp
	Friend Class Program
		Public Shared Sub Main(ByVal args() As String) ' Main function to convert XLSB to PDF using C#
			' Remove the watermathe rk in output PDF document by adding license
			Dim licensePath As String = "GroupDocs.Conversion.lic"
			Dim lic As New GroupDocs.Conversion.License()
			lic.SetLicense(licensePath)

			' Load the source XLSB file for conversion to PDF
			Dim converter = New GroupDocs.Conversion.Converter("sample.xlsb")

			' Set convert options for the PDF document
			Dim convertOptions = New PdfConvertOptions()

			' Convert and save the XLSB in PDF format
			converter.Convert("converted.pdf", convertOptions)
			Console.WriteLine("Done")
		End Sub
	End Class
End Namespace
VB   C#

C#でVSDXをPDFに変換

GroupDocs.Conversion APIを使用してVisio VSDXファイルをPDFファイルに変換する手順は次のとおりです:

  1. NuGetパッケージマネージャーを使用して GroupDocs.Conversion ライブラリをインストールします。

  2. プロジェクトのソースファイルに GroupDocs.Conversion ネームスペースを含めてください。(s).

  3. VSDX ファイルの場所を指定して、新しい GroupDocs.Conversion.Converter オブジェクトをインスタンス化します。

  4. PdfConvertOptions クラスのインスタンスを作成し、ファイル変換オプションを指定するために使用します。

  5. コンバーターのインスタンスに対して Convert メソッドを呼び出してPDFファイルを作成します。
using System;
using GroupDocs.Conversion.Options.Convert;

namespace ConvertVsdxToPdfInCSharp
{
    class Program
    {
        public static void Main(string [] args) // Main function to convert VSDX to PDF using C#
        {
            // Remove the watermark in output PDF document by adding license
            string licensePath = "GroupDocs.Conversion.lic";
            GroupDocs.Conversion.License lic = new GroupDocs.Conversion.License();
            lic.SetLicense(licensePath);

            // Load the source VSDX file for conversion to PDF
            var converter = new GroupDocs.Conversion.Converter("sample.vsdx");

            // Set the convert options for PDF document
            var convertOptions = new PdfConvertOptions();

            // Convert and save the VSDX in PDF format
            converter.Convert("converted.pdf", convertOptions);

            Console.WriteLine("Done");
        }
    }
}
using System;
using GroupDocs.Conversion.Options.Convert;

namespace ConvertVsdxToPdfInCSharp
{
    class Program
    {
        public static void Main(string [] args) // Main function to convert VSDX to PDF using C#
        {
            // Remove the watermark in output PDF document by adding license
            string licensePath = "GroupDocs.Conversion.lic";
            GroupDocs.Conversion.License lic = new GroupDocs.Conversion.License();
            lic.SetLicense(licensePath);

            // Load the source VSDX file for conversion to PDF
            var converter = new GroupDocs.Conversion.Converter("sample.vsdx");

            // Set the convert options for PDF document
            var convertOptions = new PdfConvertOptions();

            // Convert and save the VSDX in PDF format
            converter.Convert("converted.pdf", convertOptions);

            Console.WriteLine("Done");
        }
    }
}
Imports System
Imports GroupDocs.Conversion.Options.Convert

Namespace ConvertVsdxToPdfInCSharp
	Friend Class Program
		Public Shared Sub Main(ByVal args() As String) ' Main function to convert VSDX to PDF using C#
			' Remove the watermark in output PDF document by adding license
			Dim licensePath As String = "GroupDocs.Conversion.lic"
			Dim lic As New GroupDocs.Conversion.License()
			lic.SetLicense(licensePath)

			' Load the source VSDX file for conversion to PDF
			Dim converter = New GroupDocs.Conversion.Converter("sample.vsdx")

			' Set the convert options for PDF document
			Dim convertOptions = New PdfConvertOptions()

			' Convert and save the VSDX in PDF format
			converter.Convert("converted.pdf", convertOptions)

			Console.WriteLine("Done")
		End Sub
	End Class
End Namespace
VB   C#

C#を使用してHTMLをPDFに変換する

この例では、GroupDocs.Conversionを使用する方法を示します。 HTMLからPDFファイルを生成する. それは Converter クラスを使用してソースドキュメントを読み込み、PdfConvertOptions クラスを使用して出力ドキュメントのプロパティを定義し、Convert 関数を使用してソースドキュメントをPDFファイルとしてレンダリングします。

using System;
using GroupDocs.Conversion.Options.Convert;

namespace ConvertVsdxToPdfInCSharp
{
    class Program
    {
        public static void Main(string [] args) // Main function to convert VSDX to PDF using C#
        {
            // Remove the watermark in output PDF document by adding license
            string licensePath = "GroupDocs.Conversion.lic";
            GroupDocs.Conversion.License lic = new GroupDocs.Conversion.License();
            lic.SetLicense(licensePath);

            // Load the source VSDX file for conversion to PDF
            var converter = new GroupDocs.Conversion.Converter("sample.vsdx");

            // Set the convert options for PDF document
            var convertOptions = new PdfConvertOptions();

            // Convert and save the VSDX in PDF format
            converter.Convert("converted.pdf", convertOptions);

            Console.WriteLine("Done");
        }
    }
}
using System;
using GroupDocs.Conversion.Options.Convert;

namespace ConvertVsdxToPdfInCSharp
{
    class Program
    {
        public static void Main(string [] args) // Main function to convert VSDX to PDF using C#
        {
            // Remove the watermark in output PDF document by adding license
            string licensePath = "GroupDocs.Conversion.lic";
            GroupDocs.Conversion.License lic = new GroupDocs.Conversion.License();
            lic.SetLicense(licensePath);

            // Load the source VSDX file for conversion to PDF
            var converter = new GroupDocs.Conversion.Converter("sample.vsdx");

            // Set the convert options for PDF document
            var convertOptions = new PdfConvertOptions();

            // Convert and save the VSDX in PDF format
            converter.Convert("converted.pdf", convertOptions);

            Console.WriteLine("Done");
        }
    }
}
Imports System
Imports GroupDocs.Conversion.Options.Convert

Namespace ConvertVsdxToPdfInCSharp
	Friend Class Program
		Public Shared Sub Main(ByVal args() As String) ' Main function to convert VSDX to PDF using C#
			' Remove the watermark in output PDF document by adding license
			Dim licensePath As String = "GroupDocs.Conversion.lic"
			Dim lic As New GroupDocs.Conversion.License()
			lic.SetLicense(licensePath)

			' Load the source VSDX file for conversion to PDF
			Dim converter = New GroupDocs.Conversion.Converter("sample.vsdx")

			' Set the convert options for PDF document
			Dim convertOptions = New PdfConvertOptions()

			' Convert and save the VSDX in PDF format
			converter.Convert("converted.pdf", convertOptions)

			Console.WriteLine("Done")
		End Sub
	End Class
End Namespace
VB   C#

この例では、生成されるPDFドキュメントのパラメータの一部しか説明されていません。 開発者は、余白の調整、パスワードの設定、透かしの追加など、追加のファイル変換オプションを指定できます。

C# を使用して RTF を PDF に変換

GroupDocsを使用してRTFファイルを迅速にPDFに変換するには:

  1. 必要なものをまずインストールしてください NuGetパッケージ プロジェクトのソースコードで適切な名前空間を参照することによって

  2. Converter クラスのインスタンスを作成して、ソースRTFファイルを読み込みます。

  3. PdfConvertOptionsオブジェクトを初期化して、レンダリングされたPDFドキュメントのプロパティを定義します。

  4. 最後に、Convert を利用して (出力場所と PdfConvertOptions インスタンスを渡す) RTFファイルをPDFファイルとしてレンダリングする。
using System;
using GroupDocs.Conversion.Options.Convert;

namespace ConvertRtfToPdfUsingCSharp
{
    class Program
    {
        public static void Main(string [] args) // Main function to convert RTF to PDF using C#
        {
            // Remove the watermark in output PDF document by adding license
            string licensePath = "GroupDocs.Conversion.lic";
            GroupDocs.Conversion.License lic = new GroupDocs.Conversion.License();
            lic.SetLicense(licensePath);

            // Load the source RTF file for conversion to PDF
            var converter = new GroupDocs.Conversion.Converter("sample.rtf");

            // Set the properties for the output PDF document
            var convertOptions = new PdfConvertOptions()
            {
                Height = 500,
                Width = 500,
                Dpi = 100,
                PageNumber = 1,
                PagesCount = 1
            };

            // Convert and save the RTF in PDF format
            converter.Convert("converted.pdf", convertOptions);

            Console.WriteLine("Done");
        }
    }
}
using System;
using GroupDocs.Conversion.Options.Convert;

namespace ConvertRtfToPdfUsingCSharp
{
    class Program
    {
        public static void Main(string [] args) // Main function to convert RTF to PDF using C#
        {
            // Remove the watermark in output PDF document by adding license
            string licensePath = "GroupDocs.Conversion.lic";
            GroupDocs.Conversion.License lic = new GroupDocs.Conversion.License();
            lic.SetLicense(licensePath);

            // Load the source RTF file for conversion to PDF
            var converter = new GroupDocs.Conversion.Converter("sample.rtf");

            // Set the properties for the output PDF document
            var convertOptions = new PdfConvertOptions()
            {
                Height = 500,
                Width = 500,
                Dpi = 100,
                PageNumber = 1,
                PagesCount = 1
            };

            // Convert and save the RTF in PDF format
            converter.Convert("converted.pdf", convertOptions);

            Console.WriteLine("Done");
        }
    }
}
Imports System
Imports GroupDocs.Conversion.Options.Convert

Namespace ConvertRtfToPdfUsingCSharp
	Friend Class Program
		Public Shared Sub Main(ByVal args() As String) ' Main function to convert RTF to PDF using C#
			' Remove the watermark in output PDF document by adding license
			Dim licensePath As String = "GroupDocs.Conversion.lic"
			Dim lic As New GroupDocs.Conversion.License()
			lic.SetLicense(licensePath)

			' Load the source RTF file for conversion to PDF
			Dim converter = New GroupDocs.Conversion.Converter("sample.rtf")

			' Set the properties for the output PDF document
			Dim convertOptions = New PdfConvertOptions() With {
				.Height = 500,
				.Width = 500,
				.Dpi = 100,
				.PageNumber = 1,
				.PagesCount = 1
			}

			' Convert and save the RTF in PDF format
			converter.Convert("converted.pdf", convertOptions)

			Console.WriteLine("Done")
		End Sub
	End Class
End Namespace
VB   C#

C# で Excel を PDF に変換

using System;
using GroupDocs.Conversion.Options.Convert;

namespace ConvertExcelToPdfInCSharp
{
    class Program
    {
        public static void Main(string [] args) // Main function to convert Excel to PDF using C#
        {
            // Remove the watermark in output PDF document by adding license
            string licensePath = "GroupDocs.Conversion.lic";
            GroupDocs.Conversion.License lic = new GroupDocs.Conversion.License();
            lic.SetLicense(licensePath);

            // Load the source Excel file for conversion to PDF
            var converter = new GroupDocs.Conversion.Converter("sample.xlsx");

            // Set the starting sheet number and consecutive sheet count
            var convertOptions = new PdfConvertOptions()
            {
                PageNumber = 1,
                PagesCount = 2
            };

            // Convert and save the Excel in PDF format
            converter.Convert("converted.pdf", convertOptions);

            Console.WriteLine("Done");
        }
    }
}
using System;
using GroupDocs.Conversion.Options.Convert;

namespace ConvertExcelToPdfInCSharp
{
    class Program
    {
        public static void Main(string [] args) // Main function to convert Excel to PDF using C#
        {
            // Remove the watermark in output PDF document by adding license
            string licensePath = "GroupDocs.Conversion.lic";
            GroupDocs.Conversion.License lic = new GroupDocs.Conversion.License();
            lic.SetLicense(licensePath);

            // Load the source Excel file for conversion to PDF
            var converter = new GroupDocs.Conversion.Converter("sample.xlsx");

            // Set the starting sheet number and consecutive sheet count
            var convertOptions = new PdfConvertOptions()
            {
                PageNumber = 1,
                PagesCount = 2
            };

            // Convert and save the Excel in PDF format
            converter.Convert("converted.pdf", convertOptions);

            Console.WriteLine("Done");
        }
    }
}
Imports System
Imports GroupDocs.Conversion.Options.Convert

Namespace ConvertExcelToPdfInCSharp
	Friend Class Program
		Public Shared Sub Main(ByVal args() As String) ' Main function to convert Excel to PDF using C#
			' Remove the watermark in output PDF document by adding license
			Dim licensePath As String = "GroupDocs.Conversion.lic"
			Dim lic As New GroupDocs.Conversion.License()
			lic.SetLicense(licensePath)

			' Load the source Excel file for conversion to PDF
			Dim converter = New GroupDocs.Conversion.Converter("sample.xlsx")

			' Set the starting sheet number and consecutive sheet count
			Dim convertOptions = New PdfConvertOptions() With {
				.PageNumber = 1,
				.PagesCount = 2
			}

			' Convert and save the Excel in PDF format
			converter.Convert("converted.pdf", convertOptions)

			Console.WriteLine("Done")
		End Sub
	End Class
End Namespace
VB   C#

C#で画像をPDFに変換

GroupDocsを使用すると、数行のコードでJPG画像フォーマットをPDFドキュメントに変換することができます。 GroupDocsは、PNG、TIFF、BMPなどの他の画像形式も簡単に変換できます。

using System;
using GroupDocs.Conversion.Options.Convert;

namespace ConvertExcelToPdfInCSharp
{
    class Program
    {
        public static void Main(string [] args) // Main function to convert Excel to PDF using C#
        {
            // Remove the watermark in output PDF document by adding license
            string licensePath = "GroupDocs.Conversion.lic";
            GroupDocs.Conversion.License lic = new GroupDocs.Conversion.License();
            lic.SetLicense(licensePath);

            // Load the source Excel file for conversion to PDF
            var converter = new GroupDocs.Conversion.Converter("sample.xlsx");

            // Set the starting sheet number and consecutive sheet count
            var convertOptions = new PdfConvertOptions()
            {
                PageNumber = 1,
                PagesCount = 2
            };

            // Convert and save the Excel in PDF format
            converter.Convert("converted.pdf", convertOptions);

            Console.WriteLine("Done");
        }
    }
}
using System;
using GroupDocs.Conversion.Options.Convert;

namespace ConvertExcelToPdfInCSharp
{
    class Program
    {
        public static void Main(string [] args) // Main function to convert Excel to PDF using C#
        {
            // Remove the watermark in output PDF document by adding license
            string licensePath = "GroupDocs.Conversion.lic";
            GroupDocs.Conversion.License lic = new GroupDocs.Conversion.License();
            lic.SetLicense(licensePath);

            // Load the source Excel file for conversion to PDF
            var converter = new GroupDocs.Conversion.Converter("sample.xlsx");

            // Set the starting sheet number and consecutive sheet count
            var convertOptions = new PdfConvertOptions()
            {
                PageNumber = 1,
                PagesCount = 2
            };

            // Convert and save the Excel in PDF format
            converter.Convert("converted.pdf", convertOptions);

            Console.WriteLine("Done");
        }
    }
}
Imports System
Imports GroupDocs.Conversion.Options.Convert

Namespace ConvertExcelToPdfInCSharp
	Friend Class Program
		Public Shared Sub Main(ByVal args() As String) ' Main function to convert Excel to PDF using C#
			' Remove the watermark in output PDF document by adding license
			Dim licensePath As String = "GroupDocs.Conversion.lic"
			Dim lic As New GroupDocs.Conversion.License()
			lic.SetLicense(licensePath)

			' Load the source Excel file for conversion to PDF
			Dim converter = New GroupDocs.Conversion.Converter("sample.xlsx")

			' Set the starting sheet number and consecutive sheet count
			Dim convertOptions = New PdfConvertOptions() With {
				.PageNumber = 1,
				.PagesCount = 2
			}

			' Convert and save the Excel in PDF format
			converter.Convert("converted.pdf", convertOptions)

			Console.WriteLine("Done")
		End Sub
	End Class
End Namespace
VB   C#

GroupDocs APIは、写真をMicrosoft Word、Excel、およびPowerPointなどの他のドキュメント形式に変換することができます。

IronPDFを使用してファイルをPDFに変換する

IronPDF for .NET Coreと.NET Frameworkは、HTMLコンテンツをPDFファイルに変換するためにChromiumランタイムエンジンを使用します。 HTMLはIronPDFのコア機能セットの基本です。 そのHTMLドキュメントのPDFファイルへのレンダリングは、Google Chromeのデスクトップで表示されるものとピクセル単位で同じ、まさに一字一句一致しています。

ライブラリは、そうするためのいくつかのオプションを提供しています。 次のセクションでは、それらの詳細を検討します。

HTMLからPDF

IronPDFは、以下の例のように生のHTML、CSS、およびJavaScriptソースコードを直接PDFファイルとしてレンダリングすることができます。

using IronPdf;
var Renderer = new IronPdf.ChromePdfRenderer();
using var PDF = Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>")
PDF.SaveAs("pixel-perfect.pdf");

/****** Advanced ******/
// Load external html assets: images, css and javascript.
// An optional BasePath 'C:\site\assets\' is set as the file location to load assets from
using var AdvancedPDF = Renderer.RenderHtmlAsPdf("<img src='icons/iron.png'>", @"C:\site\assets\");
AdvancedPDF.SaveAs("html-with-assets.pdf");
using IronPdf;
var Renderer = new IronPdf.ChromePdfRenderer();
using var PDF = Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>")
PDF.SaveAs("pixel-perfect.pdf");

/****** Advanced ******/
// Load external html assets: images, css and javascript.
// An optional BasePath 'C:\site\assets\' is set as the file location to load assets from
using var AdvancedPDF = Renderer.RenderHtmlAsPdf("<img src='icons/iron.png'>", @"C:\site\assets\");
AdvancedPDF.SaveAs("html-with-assets.pdf");
Imports IronPdf
Private Renderer = New IronPdf.ChromePdfRenderer()
Private PDF = Renderer.RenderHtmlAsPdf("<h1>Html with CSS and Images</h1>") PDF.SaveAs("pixel-perfect.pdf")

'''**** Advanced *****
' Load external html assets: images, css and javascript.
' An optional BasePath 'C:\site\assets\' is set as the file location to load assets from
Private AdvancedPDF = Renderer.RenderHtmlAsPdf("<img src='icons/iron.png'>", "C:\site\assets\")
AdvancedPDF.SaveAs("html-with-assets.pdf")
VB   C#

URLをPDFに変換

IronPDFを使用すると、既存のURLからHTMLをPDFドキュメントに簡単に変換することができます。

using IronPdf;
IronPdf.ChromePdfRenderer Renderer = new IronPdf.ChromePdfRenderer();
using var Pdf = Renderer.RenderUrlAsPdf("https://ironpdf.com/");

Pdf.SaveAs("url.pdf");
using IronPdf;
IronPdf.ChromePdfRenderer Renderer = new IronPdf.ChromePdfRenderer();
using var Pdf = Renderer.RenderUrlAsPdf("https://ironpdf.com/");

Pdf.SaveAs("url.pdf");
Imports IronPdf
Private Renderer As New IronPdf.ChromePdfRenderer()
Private Pdf = Renderer.RenderUrlAsPdf("https://ironpdf.com/")

Pdf.SaveAs("url.pdf")
VB   C#

この機能により、デザイナーとコーダーは、クエリ文字列変数をサポートするASP.NETのURLからPDFをレンダリングすることで、PDF開発における効率的なコラボレーションが可能になります。

ASPX ページを PDF に変換

IronPDFライブラリはレンダリング可能です ASP.NET アプリケーションの Form_Load イベントにコードを1行追加するだけで、HTMLではなくPDFとしてウェブページを表示できます。

private void Form1_Load(object sender, EventArgs e)
{
    IronPdf.AspxToPdf.RenderThisPageAsPdf();
}
private void Form1_Load(object sender, EventArgs e)
{
    IronPdf.AspxToPdf.RenderThisPageAsPdf();
}
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
	IronPdf.AspxToPdf.RenderThisPageAsPdf()
End Sub
VB   C#

これにより、シンプルさを求めてデータ駆動型PDFを最初にHTMLとして設計およびテストすることができます。

PDF 画像変換

PDFドキュメントは、IronPdf.ImageToPdfConverterクラスを使用して、1つまたは複数の画像ファイルから簡単に作成できます。

// PM> Install-Package IronPdf
using IronPdf;
using System.IO;
using System.Linq;

// One or more images as IEnumerable.  This example selects all JPEG images in a spe-cific folder.
var ImageFiles = System.IO.Directory.EnumerateFiles(@"C:\project\assets").Where(f => f.EndsWith(".jpg") 
 f.EndsWith(".jpeg"));

// Convert the images to a PDF and save it.
ImageToPdfConverter.ImageToPdf(ImageFiles).SaveAs(@"C:\project\composite.pdf");
//Also see PdfDocument.RasterizeToImageFiles() method to flatten a PDF to images or thumbnails
// PM> Install-Package IronPdf
using IronPdf;
using System.IO;
using System.Linq;

// One or more images as IEnumerable.  This example selects all JPEG images in a spe-cific folder.
var ImageFiles = System.IO.Directory.EnumerateFiles(@"C:\project\assets").Where(f => f.EndsWith(".jpg") 
 f.EndsWith(".jpeg"));

// Convert the images to a PDF and save it.
ImageToPdfConverter.ImageToPdf(ImageFiles).SaveAs(@"C:\project\composite.pdf");
//Also see PdfDocument.RasterizeToImageFiles() method to flatten a PDF to images or thumbnails
IRON VB CONVERTER ERROR developers@ironsoftware.com
VB   C#

HTML内のJavaScriptをPDFに変換

IronPDFには、HTMLからPDFへの変換において包括的なJavaScript互換性が含まれており、Angular.jsや他の人気のあるフロントエンドおよびシングルページのウェブフレームワークのサポートも含まれています。

IronPDFは、ユーザーがJavaScriptを使用して画像やその他のコンテンツタイプをPDFに埋め込むことを可能にします。 ライブラリは、これをHTML文字列として直接埋め込むことにより実現します。

このように埋め込めるコンテンツには、IronPDF が含まれます (を含むが、これに限定されない):

  • 画像を含むファイル
  • System.Drawing.Image

  • System.Drawing.Bitmap

    これはHTMLからPDFへのレンダリング中に外部アセットのロードを避けるのに便利です。 それは速度を向上させ、文字列やデータベースなどのファイルシステム以外の場所に保存された全体のレンダリングジョブを可能にします。

// PM> Install-Package IronPdf
using IronPdf;

var htmlWithJs = @"
    <h1>This is HTML</h1>
    <script>
          document.write('<h1>This is JavaScript</h1>');
    </script>";

var Renderer = new IronPdf.ChromePdfRenderer();

Renderer.RenderingOptions.EnableJavaScript = true;
Renderer.RenderingOptions.RenderDelay = 100;

using var pdfdoc = Renderer.RenderHtmlAsPdf(htmlWithJs);
pdfdoc.SaveAs("js.pdf");
// PM> Install-Package IronPdf
using IronPdf;

var htmlWithJs = @"
    <h1>This is HTML</h1>
    <script>
          document.write('<h1>This is JavaScript</h1>');
    </script>";

var Renderer = new IronPdf.ChromePdfRenderer();

Renderer.RenderingOptions.EnableJavaScript = true;
Renderer.RenderingOptions.RenderDelay = 100;

using var pdfdoc = Renderer.RenderHtmlAsPdf(htmlWithJs);
pdfdoc.SaveAs("js.pdf");
' PM> Install-Package IronPdf
Imports IronPdf

Private htmlWithJs = "
    <h1>This is HTML</h1>
    <script>
          document.write('<h1>This is JavaScript</h1>');
    </script>"

Private Renderer = New IronPdf.ChromePdfRenderer()

Renderer.RenderingOptions.EnableJavaScript = True
Renderer.RenderingOptions.RenderDelay = 100

Dim pdfdoc = Renderer.RenderHtmlAsPdf(htmlWithJs)
pdfdoc.SaveAs("js.pdf")
VB   C#

Angular.JS を PDF に変換

Angularを使用してコンテンツを動的に読み込むウェブページに対して、IronPDFは非同期コンテンツの読み込み時間を許可できます。

以下の例では、プログラムはウェブページを完全にレンダリングする前に半秒待ちます。

// PM> Install-Package IronPdf
using IronPdf;
var Renderer = new IronPdf.ChromePdfRenderer();

Renderer.RenderingOptions.EnableJavaScript = true;
Renderer.RenderingOptions.RenderDelay = 500;

using var pdfdoc = Renderer.RenderUrlAsPdf("https://angular.io/");
pdfdoc.SaveAs("angular.pdf");
// PM> Install-Package IronPdf
using IronPdf;
var Renderer = new IronPdf.ChromePdfRenderer();

Renderer.RenderingOptions.EnableJavaScript = true;
Renderer.RenderingOptions.RenderDelay = 500;

using var pdfdoc = Renderer.RenderUrlAsPdf("https://angular.io/");
pdfdoc.SaveAs("angular.pdf");
' PM> Install-Package IronPdf
Imports IronPdf
Private Renderer = New IronPdf.ChromePdfRenderer()

Renderer.RenderingOptions.EnableJavaScript = True
Renderer.RenderingOptions.RenderDelay = 500

Dim pdfdoc = Renderer.RenderUrlAsPdf("https://angular.io/")
pdfdoc.SaveAs("angular.pdf")
VB   C#

PDFドキュメント署名

PDFファイルは、データの保存、文書のレイアウトの維持、フォントやグラフィックスの保持に最適です。 在宅勤務は、現代の世界では一般的になりました。 書類を記入し署名すること、ファイルを配信すること、そして文書を処理することは、組織が達成すべき日常的な業務のほんの一部に過ぎません。 物理的な署名の代わりにPDF署名を提供することは、現在重要な活動となっています。 デジタル署名は、企業が新しい方法で契約や合意を締結し、オンラインでPDFドキュメントを交換することを求める中で、ますます重要になっています。

Groupdocsを使用したデジタルドキュメント署名

C#、ASP.NET、およびその他の.NETベースの技術でアプリケーションを構築し、GroupDocs.Signature for .NET APIを使用して、ユーザーが他のサードパーティソフトウェアをインストールせずにデジタルビジネス文書に署名できるようにします。 この電子署名ライブラリは使いやすいです。 .NET開発者は、さまざまなドキュメントタイプから電子署名を行い、検索操作を実行し、e-署名を検証する機能をアプリケーションに統合できます。

GroupDocs.Signatureは、PDF、Word、Excel、PowerPoint、OpenDocument、画像、およびその他の業界標準のファイル形式をサポートしています。 署名タイプとして、テキスト、画像、バーコード、QRコード、フォームフィールド、スタンプ、およびメタデータを使用できます。

using (Signature signature = new Signature("D:\\sample.pdf"))
{
TextSignOptions options = new TextSignOptions("John Smith")
{
// set Text color
ForeColor = Color.Red
};
// sign document to file
signature.Sign("D:\\signed.pdf", options);
}
using (Signature signature = new Signature("D:\\sample.pdf"))
{
TextSignOptions options = new TextSignOptions("John Smith")
{
// set Text color
ForeColor = Color.Red
};
// sign document to file
signature.Sign("D:\\signed.pdf", options);
}
Using signature As New Signature("D:\sample.pdf")
Dim options As New TextSignOptions("John Smith") With {.ForeColor = Color.Red}
' sign document to file
signature.Sign("D:\signed.pdf", options)
End Using
VB   C#

IronPDFを使用したデジタル文書署名プロセス

IronPDFは、デスクトップコンピュータ上でC#ベースのPDFアクティビティに最適な選択です。 開発者はこれを使用して、署名を追加したり、PDFドキュメントに記入して署名したり、PDFフォームを暗号で保護したり、さらには署名の画像を追加したりすることができます。

開発者は、IronPDFとC#を使用してプログラム的にPDFに署名を追加する方法について頻繁に質問します。 これは開発者にとってさまざまな意味を持つことがあります:

  • 画像ファイルから既存のPDFファイルにグラフィカルデジタル署名の画像を追加する
  • PDFを暗号的に署名して、誰かがそれを改ざんしていないことを確認します

  • 暗号署名が付されたPDFに手書きの署名アイコンを追加する。

    最初の方法は、既存のPDFページに署名PNGをスタンプすることです。 署名や会社印として使用することができます。この手続きを完了するには、ほんの数行のコードが必要です。

// open an existing PDF document or create a new one
PdfDocument Pdf = PdfDocument.FromFile(@"C:\Path\To\ASPX to PDF.pdf");
var SignatureStamp = new HtmlStamp() { Html = "<img src='signature.png' />", Width = 150, Height = 50, Bottom = 300, Left=85, ZIndex = HtmlStamp.StampLayer.OnTopOfExistingPDFContent };
Pdf.StampHTML(SignatureStamp,1);
Pdf.SaveAs(@"C:\Path\To\ASPX to PDF.pdf");
// open an existing PDF document or create a new one
PdfDocument Pdf = PdfDocument.FromFile(@"C:\Path\To\ASPX to PDF.pdf");
var SignatureStamp = new HtmlStamp() { Html = "<img src='signature.png' />", Width = 150, Height = 50, Bottom = 300, Left=85, ZIndex = HtmlStamp.StampLayer.OnTopOfExistingPDFContent };
Pdf.StampHTML(SignatureStamp,1);
Pdf.SaveAs(@"C:\Path\To\ASPX to PDF.pdf");
' open an existing PDF document or create a new one
Dim Pdf As PdfDocument = PdfDocument.FromFile("C:\Path\To\ASPX to PDF.pdf")
Dim SignatureStamp = New HtmlStamp() With {
	.Html = "<img src='signature.png' />",
	.Width = 150,
	.Height = 50,
	.Bottom = 300,
	.Left=85,
	.ZIndex = HtmlStamp.StampLayer.OnTopOfExistingPDFContent
}
Pdf.StampHTML(SignatureStamp,1)
Pdf.SaveAs("C:\Path\To\ASPX to PDF.pdf")
VB   C#

以下のコードは、.pfx および .p12 X509Certificate2 デジタル証明書を使用してPDFに電子署名を行います。

// 123456 below represents the signature password
new IronPdf.PdfSignature("CertificateFile.p12", "123456").SignPdfFile("ASPX to PDF.pdf");
// 123456 below represents the signature password
new IronPdf.PdfSignature("CertificateFile.p12", "123456").SignPdfFile("ASPX to PDF.pdf");
' 123456 below represents the signature password
Call (New IronPdf.PdfSignature("CertificateFile.p12", "123456")).SignPdfFile("ASPX to PDF.pdf")
VB   C#

以下のより複雑な例では、手書き署名のスキャンと一緒に X509Certificate2 デジタルID署名方法を使用しています。

var Signature = new IronPdf.PdfSignature("Iron.pfx", "123456");
PdfDocument doc = Renderer.RenderHtmlAsPdf("<h1>Testing 2048 bit digital securi-ty</h1>");

// Step 3. Optional signing options and a handwritten Signature graphic
Signature.SigningContact = "support@ironsoftware.com";
Signature.SigningLocation = "Chicago, USA";
Signature.SigningReason = "To show how to sign a PDF";
Signature.LoadSignatureImageFromFile("handwriting.png");
doc.SignPdfWithDigitalSignature(Signature);
doc.SaveAs("ASPX to PDF.pdf"); 
var Signature = new IronPdf.PdfSignature("Iron.pfx", "123456");
PdfDocument doc = Renderer.RenderHtmlAsPdf("<h1>Testing 2048 bit digital securi-ty</h1>");

// Step 3. Optional signing options and a handwritten Signature graphic
Signature.SigningContact = "support@ironsoftware.com";
Signature.SigningLocation = "Chicago, USA";
Signature.SigningReason = "To show how to sign a PDF";
Signature.LoadSignatureImageFromFile("handwriting.png");
doc.SignPdfWithDigitalSignature(Signature);
doc.SaveAs("ASPX to PDF.pdf"); 
Dim Signature = New IronPdf.PdfSignature("Iron.pfx", "123456")
Dim doc As PdfDocument = Renderer.RenderHtmlAsPdf("<h1>Testing 2048 bit digital securi-ty</h1>")

' Step 3. Optional signing options and a handwritten Signature graphic
Signature.SigningContact = "support@ironsoftware.com"
Signature.SigningLocation = "Chicago, USA"
Signature.SigningReason = "To show how to sign a PDF"
Signature.LoadSignatureImageFromFile("handwriting.png")
doc.SignPdfWithDigitalSignature(Signature)
doc.SaveAs("ASPX to PDF.pdf")
VB   C#

PDFファイルの結合

GroupDocs.Mergerを使用してPDFを結合する

複数のPDFファイルを単一のドキュメントに統合する必要がある場合や添付ファイルを減らす必要がある場合、GroupDocs.Mergerは開発者がPDFファイルを結合できるようにします。 GroupDocs.Mergerは、サードパーティソフトウェアを使用したり手作業を行ったりせずにこれを達成します。

GroupDocs.Mergerは、あらゆるサイズや構造のPDFドキュメントを結合することができます。 APIは、すべてのテキスト、写真、表、グラフ、フォーム、およびその他のコンテンツを元のサイズとフォーマットで保持します。

次の例は、数行のC#コードでPDFファイルを結合する方法を示しています:

  • Mergerインスタンスを作成し、コンストラクタ引数としてソースPDFファイルのパスを提供します。 ご要件に応じて、絶対または相対パスを指定できます。
  • Join メソッドを使用してドキュメントを結合します。 統合したい追加のPDFドキュメントがあれば、同様に繰り返してください。

  • Save メソッドを呼び出し、出力ファイルの場所を指定して、生成されたPDFドキュメントを保存します。
// Load the source PDF file
using (Merger merger = new Merger(@"c:\sample1.pdf"))
{
    // Add another PDF file to merge
    merger.Join(@"c:\sample2.pdf");
    // Merge PDF files and save result
    merger.Save(@"c:\merged.pdf");
}
// Load the source PDF file
using (Merger merger = new Merger(@"c:\sample1.pdf"))
{
    // Add another PDF file to merge
    merger.Join(@"c:\sample2.pdf");
    // Merge PDF files and save result
    merger.Save(@"c:\merged.pdf");
}
' Load the source PDF file
Using merger As New Merger("c:\sample1.pdf")
	' Add another PDF file to merge
	merger.Join("c:\sample2.pdf")
	' Merge PDF files and save result
	merger.Save("c:\merged.pdf")
End Using
VB   C#

IronPDFを使用したPDFの結合

IronPDFを使用すると、IronPdf.PdfDocument.Mergeを使って、C#.NETで2つ以上のPDFドキュメントを簡単に結合できます。

// PM> Install-Package IronPdf
using IronPdf;
var html_a = @"<p> [PDF_A] </p>
        <p> [PDF_A] 1st Page </p>
        <div style = 'page-break-after: always;' ></div>
        <p> [PDF_A] 2nd Page</p>";

var html_b = @"<p> [PDF_B] </p>
        <p> [PDF_B] 1st Page </p>
        <div style = 'page-break-after: always;' ></div>
        <p> [PDF_B] 2nd Page</p>";

var Renderer = new IronPdf.ChromePdfRenderer();
using var pdfdoc_a = Renderer.RenderHtmlAsPdf(html_a);
using var pdfdoc_b = Renderer.RenderHtmlAsPdf(html_b);
using var merged = IronPdf.PdfDocument.Merge(pdfdoc_a, pdfdoc_b);
merged.SaveAs("Merged.pdf");
// PM> Install-Package IronPdf
using IronPdf;
var html_a = @"<p> [PDF_A] </p>
        <p> [PDF_A] 1st Page </p>
        <div style = 'page-break-after: always;' ></div>
        <p> [PDF_A] 2nd Page</p>";

var html_b = @"<p> [PDF_B] </p>
        <p> [PDF_B] 1st Page </p>
        <div style = 'page-break-after: always;' ></div>
        <p> [PDF_B] 2nd Page</p>";

var Renderer = new IronPdf.ChromePdfRenderer();
using var pdfdoc_a = Renderer.RenderHtmlAsPdf(html_a);
using var pdfdoc_b = Renderer.RenderHtmlAsPdf(html_b);
using var merged = IronPdf.PdfDocument.Merge(pdfdoc_a, pdfdoc_b);
merged.SaveAs("Merged.pdf");
' PM> Install-Package IronPdf
Imports IronPdf
Private html_a = "<p> [PDF_A] </p>
        <p> [PDF_A] 1st Page </p>
        <div style = 'page-break-after: always;' ></div>
        <p> [PDF_A] 2nd Page</p>"

Private html_b = "<p> [PDF_B] </p>
        <p> [PDF_B] 1st Page </p>
        <div style = 'page-break-after: always;' ></div>
        <p> [PDF_B] 2nd Page</p>"

Private Renderer = New IronPdf.ChromePdfRenderer()
Private pdfdoc_a = Renderer.RenderHtmlAsPdf(html_a)
Private pdfdoc_b = Renderer.RenderHtmlAsPdf(html_b)
Private merged = IronPdf.PdfDocument.Merge(pdfdoc_a, pdfdoc_b)
merged.SaveAs("Merged.pdf")
VB   C#

PDFドキュメント形式の分割

IronPDF を使った分割

IronPDFは、単一のページまたはページ範囲を抽出して新しい IronPdf.PdfDocument オブジェクトに分割することで、PDFドキュメントを分割できます。 IronPdf.PdfDocument.CopyPage は、1つまたは複数のPDFファイルからページを抽出し、新しいドキュメントに貼り付けることができます。

// PM> Install-Package IronPdf
using IronPdf;
var html = @"<p> Hello Iron </p>
    <p> This is 1st Page </p>
    <div style = 'page-break-after: always;' ></div>
    <p> This is 2nd Page</p>
    <div style = 'page-break-after: always;' ></div>
    <p> This is 3rd Page</p>";

var Renderer = new IronPdf.ChromePdfRenderer();
using var pdfdoc = Renderer.RenderHtmlAsPdf(html);

using var pdfdoc_page1 = pdfdoc.CopyPage(0);
pdfdoc_page1.SaveAs("Spli1.pdf");

using var pdfdoc_page2_3 = pdfdoc.CopyPages(1, 2);
pdfdoc_page2_3.SaveAs("Spli2.pdf");
//take the pages 2 & 3
// PM> Install-Package IronPdf
using IronPdf;
var html = @"<p> Hello Iron </p>
    <p> This is 1st Page </p>
    <div style = 'page-break-after: always;' ></div>
    <p> This is 2nd Page</p>
    <div style = 'page-break-after: always;' ></div>
    <p> This is 3rd Page</p>";

var Renderer = new IronPdf.ChromePdfRenderer();
using var pdfdoc = Renderer.RenderHtmlAsPdf(html);

using var pdfdoc_page1 = pdfdoc.CopyPage(0);
pdfdoc_page1.SaveAs("Spli1.pdf");

using var pdfdoc_page2_3 = pdfdoc.CopyPages(1, 2);
pdfdoc_page2_3.SaveAs("Spli2.pdf");
//take the pages 2 & 3
' PM> Install-Package IronPdf
Imports IronPdf
Private html = "<p> Hello Iron </p>
    <p> This is 1st Page </p>
    <div style = 'page-break-after: always;' ></div>
    <p> This is 2nd Page</p>
    <div style = 'page-break-after: always;' ></div>
    <p> This is 3rd Page</p>"

Private Renderer = New IronPdf.ChromePdfRenderer()
Private pdfdoc = Renderer.RenderHtmlAsPdf(html)

Private pdfdoc_page1 = pdfdoc.CopyPage(0)
pdfdoc_page1.SaveAs("Spli1.pdf")

Dim pdfdoc_page2_3 = pdfdoc.CopyPages(1, 2)
pdfdoc_page2_3.SaveAs("Spli2.pdf")
'take the pages 2 & 3
VB   C#

GroupDocsを使用した分割

GroupDocs.Mergerは、ソースドキュメントを複数の結果ドキュメントに分割することができます。 ドキュメントの分割は、ページ番号の配列、開始/終了ページ番号、および異なる分割オプションモードを指定することで、異なる方法で実行できます。 こちらは考えられる使用例です:

  1. ページ番号配列が指定され、分割モードがSplitMode.Pagesに設定されている場合、ページ番号は個別の1ページ文書に格納された正確なページ番号を示します。

    例: 配列{ 3、6、8 } 第3、6、8ページを含む3つのドキュメントを生成します。

  2. ページ番号の配列が指定され、分割モードが SplitMode.Interval に設定されています。指定されたページ番号は、個別の複数ページのドキュメントに保存されるページ間隔の境界を示しています。

    例: 配列{ 3、6、8 } 1-2、3-5、6-7、8-10の4つのページ間隔を生成します。

    希望するページ範囲から偶数ページまたは奇数ページのみを取得するために、ParameterRangeModeを設定するオプションもあります。

    特定のページ番号でドキュメントを複数の1ページ文書に分割する

string filePath = @"c:\sample.docx";
string filePathOut = @"c:\output\document_{0}.{1}";

SplitOptions splitOptions = new SplitOptions(filePathOut, new int [] { 3, 6, 8 });

using (Merger merger = new Merger(filePath))
{
     merger.Split(splitOptions);
}
string filePath = @"c:\sample.docx";
string filePathOut = @"c:\output\document_{0}.{1}";

SplitOptions splitOptions = new SplitOptions(filePathOut, new int [] { 3, 6, 8 });

using (Merger merger = new Merger(filePath))
{
     merger.Split(splitOptions);
}
Dim filePath As String = "c:\sample.docx"
Dim filePathOut As String = "c:\output\document_{0}.{1}"

Dim splitOptions As New SplitOptions(filePathOut, New Integer () { 3, 6, 8 })

Using merger As New Merger(filePath)
	 merger.Split(splitOptions)
End Using
VB   C#

開始ページ番号と終了ページ番号に基づいて文書を複数の1ページ文書に分割

string filePath = @"c:\sample.docx";
string filePathOut = @"c:\output\document_{0}.{1}";

SplitOptions splitOptions = new SplitOptions(filePathOut, 3, 7);

using (Merger merger = new Merger(filePath))
{
     merger.Split(splitOptions);
}
string filePath = @"c:\sample.docx";
string filePathOut = @"c:\output\document_{0}.{1}";

SplitOptions splitOptions = new SplitOptions(filePathOut, 3, 7);

using (Merger merger = new Merger(filePath))
{
     merger.Split(splitOptions);
}
Dim filePath As String = "c:\sample.docx"
Dim filePathOut As String = "c:\output\document_{0}.{1}"

Dim splitOptions As New SplitOptions(filePathOut, 3, 7)

Using merger As New Merger(filePath)
	 merger.Split(splitOptions)
End Using
VB   C#

開始/終了ページ番号や偶数/奇数フィルターによって、ドキュメントを複数の1ページドキュメントに分割する

string filePath = @"c:\sample.docx";
string filePathOut = @"c:\output\document_{0}.{1}";

SplitOptions splitOptions = new SplitOptions(filePathOut, 3, 7, RangeMode.OddPages);

using (Merger merger = new Merger(filePath))
{
     merger.Split(splitOptions);
}
string filePath = @"c:\sample.docx";
string filePathOut = @"c:\output\document_{0}.{1}";

SplitOptions splitOptions = new SplitOptions(filePathOut, 3, 7, RangeMode.OddPages);

using (Merger merger = new Merger(filePath))
{
     merger.Split(splitOptions);
}
Dim filePath As String = "c:\sample.docx"
Dim filePathOut As String = "c:\output\document_{0}.{1}"

Dim splitOptions As New SplitOptions(filePathOut, 3, 7, RangeMode.OddPages)

Using merger As New Merger(filePath)
	 merger.Split(splitOptions)
End Using
VB   C#

ドキュメントを複数のページを持ついくつかのドキュメントに分割する

string filePath = @"c:\sample.docx";
string filePathOut = @"c:\output\document_{0}.{1}";

SplitOptions splitOptions = new SplitOptions(filePathOut, new int [] { 3, 6, 8 }, Split-Mode.Interval);

using (Merger merger = new Merger(filePath))
{
     merger.Split(splitOptions);
}
string filePath = @"c:\sample.docx";
string filePathOut = @"c:\output\document_{0}.{1}";

SplitOptions splitOptions = new SplitOptions(filePathOut, new int [] { 3, 6, 8 }, Split-Mode.Interval);

using (Merger merger = new Merger(filePath))
{
     merger.Split(splitOptions);
}
Dim filePath As String = "c:\sample.docx"
Dim filePathOut As String = "c:\output\document_{0}.{1}"

Dim splitOptions As New SplitOptions(filePathOut, New Integer () { 3, 6, 8 }, Split-Mode.Interval)

Using merger As New Merger(filePath)
	 merger.Split(splitOptions)
End Using
VB   C#

ライセンスと価格設定

開発者はGroupDocsを使用できます .NET そして Java APIを使用して、Web、モバイル、またはデスクトップアプリケーションでドキュメントを表示、注釈付け、変換、電子署名、比較、そして組み立てる機能を追加します。 GroupDocsはあなたに対し、そのサービスを使用するための非独占的、サブライセンス不可、譲渡不可のライセンスを付与します。

IronPDFとGroupDocsの比較、図2:GroupDocsライセンシング価格表

価格は、各製品につき$1999から始まります。

IronPDFは無料のC# PDFライブラリです。 開発用には無料で使用できます。 商用利用の場合、30日間のデプロイメントトライアルを手配することができます エンジニアリングチームへの連絡.

IronPDFは簡単な価格設定を提供します。ライセンスは$749から始まり、多くのカスタマイズオプションがあります。

IronPDFとGroupDocsの比較、図2: IronPDFライセンス価格表

結論

IronPDFはリモートサーバーからHTMLをPDFに変換しません。 むしろ、それは内部の標準準拠ウェブブラウザーエンジンを利用しています。 (追加のソフトウェアをインストールする必要なしに). HTMLは、最高の商業印刷基準を満たす形式で完全に再現されます。 結果は鮮明で高品質なPDFです。

一方、GroupDocs.Total製品ファミリーは、90以上の一般的なファイル形式を処理することができます。 これにより、ドキュメントの閲覧、注釈、比較、変換、操作、自動化が可能になります。 さらに、ユーザーはデスクトップソリューション用のオンラインドキュメントビューアを使用してドキュメントを表示することができます。

IronPDFは、最初のセットアップ後に追加のダウンロードが不要であるため、時間を節約し、迅速に所期の成果を達成できる点でGroupDocsに優位性があります。 IronPDFは、ダウンロード一つで必要なすべての機能を提供します。 しかし、PDFTronには、完全なパッケージを組み立てる前に別途ダウンロードする必要があるモジュールが含まれています。 特定のモジュールをダウンロードして、機能を追加することができます。

IronPDFを使用すると、PDF操作タスクを短時間で完了させるための短いコード行を提供します。

さらに重要な点として、IronPDFのライセンスはシンプルで、すべての情報がウェブサイトで簡単に入手できるため、競合他社に対して優位性を持っています。 現在の特別なディールでは、わずか2つの価格でIron Software製品5つを手に入れることができます。

< 以前
IronPDFとApitron PDF Kitの比較
次へ >
IronPDFとPDFNetの比較

準備はできましたか? バージョン: 2024.9 新発売

無料のNuGetダウンロード 総ダウンロード数: 10,659,073 View Licenses >