跳至頁尾內容

簽署並保護PDF文件

只需幾行程式碼,即可利用現代加密、權限和簽名技術,確保 PDF 檔案的安全真實性。

Icon Main related to 簽署並保護PDF文件
確保您的文件真實性

1

數位簽名

對 PDF 文件進行數位簽名,以驗證其真實性並提供作者身份或授權證明。此功能對於法律或官方文件至關重要。

學習如何:簽署PDF文件
using IronPdf;
using IronPdf.Signing;
// Cryptographically sign an existing PDF in 1 line of code!
new IronPdf.Signing.PdfSignature("Iron.p12", "123456").SignPdfFile("any.pdf");
C#
2

編輯和簽署修訂歷史記錄

維護和編輯PDF文件的修訂歷史記錄。追蹤文件的變更、審批和簽名,以便更好地管理文件。

學習如何:編輯與修改PDF
using IronPdf;
using IronPdf.Rendering;
// Import PDF and enable TrackChanges
PdfDocument pdf = PdfDocument.FromFile("annual_census.pdf", TrackChanges: ChangeTrackingModes.EnableChangeTracking);
// ... Various edits ...
pdf.SignWithFile("/assets/IronSignature.p12", "password", null, IronPdf.Signing.SignaturePermissions.AdditionalSignaturesAndFormFillingAllowed);
PdfDocument pdfWithRevision = pdf.SaveAsRevision();
pdfWithRevision.SaveAs("annual_census_2.pdf");
C#
3

編輯 PDF 元數據

編輯 PDF 文件的元數據,例如作者、標題和主題,以改善文件的組織性和可搜尋性。

學習如何:編輯元數據
using IronPdf;
using System;

ChromePdfRenderer renderer = new ChromePdfRenderer();
PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Metadata</h1>");
// Access the MetaData class and set the pre-defined metadata properties.
pdf.MetaData.Author = "Iron Software";
pdf.MetaData.CreationDate = DateTime.Today;
pdf.MetaData.Creator = "IronPDF";
pdf.SaveAs("pdf-with-metadata.pdf");
C#

Icon Main related to 簽署並保護PDF文件
增強無縫 PDF 表單管理

1

建立 PDF 表單

建立具有可填寫欄位、複選框、單選按鈕等的互動式 PDF 表單。非常適合用於收集資訊或建立問卷。

學習如何建立 PDF 表單
using IronPdf;

// Input and Text Area forms HTML
string FormHtml = @"
<html>
    <body>
        <h2>Editable PDF Form</h2>
        <form>
            First name: <br> <input type='text' name='firstname' value=''> <br>
            Last name: <br> <input type='text' name='lastname' value=''> <br>
            Address: <br> <textarea name='address' rows='4' cols='50'></textarea>
        </form>
    </body>
</html>
";

// Instantiate Renderer
ChromePdfRenderer Renderer = new ChromePdfRenderer();
Renderer.RenderingOptions.CreatePdfFormsFromHtml = true;
Renderer.RenderHtmlAsPdf(FormHtml).SaveAs("textAreaAndInputForm.pdf");
C#
2

填寫和編輯現有表單

輕鬆填寫並編輯現有PDF表單。修改表單欄位、更新內容並儲存更改,實現無縫文件管理。

學習如何填寫和編輯表格
using IronPdf;

PdfDocument pdf = PdfDocument.FromFile("textAreaAndInputForm.pdf");

// Set text input form values
pdf.Form.FindFormField("firstname").Value = "John";
pdf.Form.FindFormField("lastname").Value = "Smith";

// Set text area form values
pdf.Form.FindFormField("address").Value = "Iron Software LLC\r\n205 N. Michigan Ave.";

pdf.SaveAs("textAreaAndInputFormEdited.pdf");
C#
3

扁平化表單字段

將表單欄位展平,以鎖定輸入的資料並防止進一步編輯,從而確保表單內容的完整性。

學習如何:扁平化表單字段
using IronPdf;

// Select the desired PDF File
PdfDocument pdf = PdfDocument.FromFile("textAreaAndInputFormEdited.pdf");

// Flatten the pdf
pdf.Flatten();

// Save as a new file
pdf.SaveAs("after_flatten.pdf");
C#

Icon Main related to 簽署並保護PDF文件
確保您的文件安全

1

對PDF文件進行清理

透過刪除隱藏的元資料、敏感內容和註釋來清理您的 PDF 文件,以保護文件的機密性和安全性。

學習如何:清理 PDF 文件
using IronPdf;

// Import PDF document
PdfDocument pdf = PdfDocument.FromFile("sample.pdf");

// Sanitize with Bitmap
PdfDocument sanitizeWithBitmap = Cleaner.SanitizeWithBitmap(pdf);

// Sanitize with SVG
PdfDocument sanitizeWithSvg = Cleaner.SanitizeWithSvg(pdf);

// Export PDFs
sanitizeWithBitmap.SaveAs("sanitizeWithBitmap.pdf");
sanitizeWithSvg.SaveAs("sanitizeWithSvg.pdf");
C#
2

設定密碼和權限

設定 PDF 檔案的密碼和權限,以控制存取權限、防止未經授權的編輯並保護敏感資訊。

了解如何設定 PDF 權限
using IronPdf;

ChromePdfRenderer renderer = new ChromePdfRenderer();

PdfDocument pdf = renderer.RenderHtmlAsPdf("<h1>Secret Information:</h1> Hello World");

// Password to edit the pdf
pdf.SecuritySettings.OwnerPassword = "123password";

// Password to open the pdf
pdf.SecuritySettings.UserPassword = "password123";
pdf.SaveAs("protected.pdf");
C#
準備好開始了嗎?
Nuget 下載 17,012,929 | 版本: 2025.12 剛剛發布