在實際環境中測試
在生產環境中測試無浮水印。
在任何需要的地方都能運作。
GroupDocs 和 IronPDF 都是跨平台應用程式,為工程師提供文件自動化的工具。它們可以建立、編輯、格式化和列印 PDF 文件,這是當今流行的文件格式之一。在使用 .NET 和 .NET Core 建構專案時,開發者需要選擇最適合該專案的工具。
開發者需要對可用的程式庫和工具有充分的了解。PDF 程式庫也不例外。由於每個程式庫都有其特定的優勢和劣勢,開發者需要選擇最符合業務和專案需求的工具。
本文將比較兩個最受 .NET 和 .NET Core 開發者歡迎的 PDF 程式庫。這兩個程式庫分別是:
IronPDF 是一個基於 C# 的商用 PDF 創建軟體包,用於 .NET 平台。它可以從 HTML、CSS、圖片和 JavaScript 生成 PDF 文件。它在 Web 應用、保密內聯網、控制台應用、WPF 應用和 MVC 模式的網站中同樣運行良好。
IronPDF 與所有從4版開始的 .NET Framework 和 .NET Core 專案兼容。
GroupDocs.Editor API 是一個跨平台的 .NET 庫,使開發者能夠創建與流行的 HTML 編輯器輕鬆對接的簡單應用程式。 (免費與付費) 轉換、編輯和操作各種文件格式的文檔。
開發人員可以使用GroupDocs.Editor加載文檔、將其轉換為HTML、將HTML發送到外部編輯器,然後將HTML保存回原始格式。此外,該API可以在編輯器內訪問與文檔相關聯的資源。它支持大量的網頁和文字處理文件格式,包括Microsoft Word、Microsoft Excel、OpenDocument、純文本、水印等。
這兩個庫有什麼區別?讓我們來找出答案。
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)
使用者可以使用IronPDF,以程式方式註釋PDF文件,方法包括IronPdf.PdfDocument.AddTextAnnotation
和PdfDocument.TextAnnotation
類別。
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
IronPDF的文字註解功能包括添加/更改顏色、調整元素大小、設置透明度、添加符號和編輯文字。
從某些文件格式轉換為PDF是維持文件完整性的基本方面。讓我們來看看這兩個軟體解決方案是如何進行不同的轉換的。
可以使用 GroupDocs 的 GroupDocs.Conversion API 將 MS Word、Excel、PowerPoint、Visio 及其他文件類型進行轉換。GroupDocs.Conversion 是一個獨立的 API,專為需要高速度的伺服器端應用程式設計。它不依賴於 Microsoft Office 或 Open Office 等生產力軟體套件。
XLSB (Excel 二進位檔案格式) 是一種將 Excel 工作簿數據以二進制而非 XML 存儲的文件類型 (與 Excel XLSX 檔案類型相同)下面的範例代碼將 XLSB 轉換為 PDF(C#)。
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
使用 GroupDocs.Conversion API 將 Visio VSDX 文件轉換為 PDF 文件的步驟如下:
使用 NuGet 包管理器安裝 GroupDocs.Conversion 庫。
在專案源文件中包含 GroupDocs.Conversion 命名空間。(s).
使用 VSDX 文件的位置,實例化一個新的 GroupDocs.Conversion.Converter 對象。
創建一個 PdfConvertOptions
類的實例,並使用它來指定文件轉換選項。
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
此範例演示如何使用GroupDocs.Conversion將HTML轉換為PDF。 從 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
在此範例中僅描述了一些生成的 PDF 文件的參數。開發人員可以指定其他檔案轉換選項,例如調整邊距、設定密碼、添加浮水印等。
要使用 GroupDocs 快速將 RTF 文件轉換為 PDF:
首先安裝所需的 NuGet 套件 並在專案源代碼中引用正確的命名空間
建立 Converter
類的實例以加載源 RTF 文件。
初始化 PdfConvertOptions
對象以定義渲染的 PDF 文檔的屬性。
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
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
使用 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
GroupDocs API 可以將照片轉換成其他文檔格式,例如 Microsoft Word、Excel 和 PowerPoint。
IronPDF for .NET Core 和 .NET Framework 使用 Chromium 執行引擎將 HTML 內容轉換為 PDF 檔案。HTML 是 IronPDF 核心功能的重點。它將 HTML 文件渲染為 PDF 檔案時,能夠像在 Google Chrome 桌面版上顯示的一樣,呈現出像素完美且精確的複製品。
此庫提供多種選項來完成此操作。以下幾節將詳盡探討其中的一些選項。
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")
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")
有了這項功能,設計師和程式設計師可以更高效地合作開發PDF,通過渲染那些支持查詢字符串變量的ASP.NET網址來生成PDF。
IronPDF 庫可以呈现 ASP.NET 只需在應用程式的Form_Load
事件中添加一行程式碼,即可將網頁作為PDF而不是HTML:
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
這使得資料驅動的PDF可以先設計並測試為HTML,從而簡化操作。
使用 IronPdf.ImageToPdfConverter
類別可以輕鬆地將一個或多個圖像文件轉換為 PDF 文件。
// 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
IronPDF 包含全面的 JavaScript 支援,將 HTML 轉換為 PDF,包括對 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")
對於使用 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")
PDF檔案非常適合用於存儲數據、保持文件佈局以及保存字體和圖形。在當今世界,居家辦公已成為常態。填寫和簽署文件、傳送檔案以及處理文件只是組織每天必須完成的一些日常任務。將PDF簽名作為實體簽名的替代品現已成為一項關鍵活動。隨著企業尋求新的方法來簽署協議和合同,以及在線交換PDF檔案,數字簽名變得越來越重要。
使用 C#、ASP.NET 和其他基於 .NET 的技術構建應用程序,允許用戶在無需安裝任何其他第三方軟件的情況下簽署數位業務文件,通過 GroupDocs.Signature for .NET API。這個電子簽名庫易於使用。 .NET 開發人員可以在其應用程序中整合廣泛的數字簽名功能,允許用戶從各種文件類型中進行簽名、執行搜索操作和驗證電子簽名。
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
IronPDF是所有基於C#的桌上型電腦PDF活動的絕佳選擇。開發人員可以使用它來添加簽名、填寫和簽署PDF文件、加密保護PDF表單,甚至添加簽名圖像。
開發人員經常詢問如何使用IronPDF和C#以程式化的方式在PDF中添加簽名。這對開發人員來說可能意味著多種情境:
第一種方法涉及將簽名PNG圖像蓋在已存在的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
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")
以下程式碼使用 .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")
下面的較複雜範例使用 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")
當需要將多個 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
IronPDF 使在 C#.NET 中使用 IronPdf.PdfDocument.Merge
合併兩個或更多 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")
IronPDF可以通過提取單頁或頁範圍將PDF文檔拆分為新的IronPdf.PdfDocument
對象。IronPdf.PdfDocument.CopyPage
可以從一個或多個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
GroupDocs.Merger 使得可以將來源文件拆分成多個結果文件。文件拆分可以通過指定頁碼數組、開始/結束頁碼和不同的拆分選項模式來完成。以下是可能的使用情況:
指定頁碼數組,拆分模式設置為 SplitMode.Pages
—— 頁碼表示存儲在單頁文件中的確切頁碼。
例: 數組{ 3, 6, 8 } 將產生包含第三、第六和第八頁的三個文件。
指定頁碼陣列,並將分割模式設置為SplitMode.Interval
—給定的頁碼表示保存於單獨的多頁文件中的頁面區間邊界。
例:陣列{ 3, 6, 8 } 將產生以下 4 個頁面區間:1-2, 3-5, 6-7, 8-10。
另外也有選項可以設置 ParameterRangeMode
,並從所需頁面範圍中僅取得偶數或奇數頁面。
按精確頁碼將文檔拆分為多個單頁文檔。
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
將文件按起始/結束頁碼拆分為多個單頁文件
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
將文件分割成幾個單頁文件,通過起始/結束頁碼和奇/偶數篩選條件
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
將文檔拆分為幾個多頁文檔
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
開發人員可以使用 GroupDocs' .NET 和 Java APIs 增加了在其網絡、移動或桌面應用程式中顯示、註釋、轉換、電子簽名、比較和組裝文件的能力。GroupDocs 授予您一個非排他的、不可再授權的、不可轉讓的使用其服務的許可證。
價格從單一產品 $1999 起。
IronPDF 是一個免費的 C# PDF 庫。它在開發階段是免費使用的。若需商業用途,30 天的部署試用可以安排。 聯繫工程團隊.
IronPDF 提供簡單明瞭的定價,可使用的授權價格從 $749 起,並有多種自訂選項。
IronPDF不會從遠端伺服器渲染HTML到PDF,而是利用內部標準兼容的網頁瀏覽器引擎。 (無需安裝任何額外的軟體)HTML 以符合最高商業印刷標準的格式完美再現。結果是一個清晰、高質量的 PDF。
另一方面,GroupDocs.Total 產品家族可以處理超過 90 種流行的文件格式。它支持文件查看、文件註釋、文件比較、文件轉換、文件操作和文件自動化。此外,用戶可以使用桌面解決方案的在線文件查看器查看文件。
IronPDF 優於 GroupDocs,因為它在首次安裝後不需要任何額外下載;這節省了時間並保證快速達成預期效果。只需一次下載,IronPDF 就提供了所有必要功能。然而,PDFTron 包括必須單獨下載的模塊,然後才能組裝完整的包。可以下載特定的模塊以添加更多功能。
IronPDF 提供短代碼行,可以用於快速完成 PDF 操作任務。
更重要的是,IronPDF 許可簡單,所有信息都可以在網站上輕鬆找到,這使它在競爭對手中脫穎而出。目前的特別優惠允許您以兩個產品的價格獲得五個 Iron Software 產品。