|
| 1 | +--- |
| 2 | +name: facades-sign-documents |
| 3 | +description: C# examples for facades-sign-documents using Aspose.PDF for .NET |
| 4 | +language: csharp |
| 5 | +framework: net10.0 |
| 6 | +parent: ../agents.md |
| 7 | +--- |
| 8 | + |
| 9 | +# AGENTS - facades-sign-documents |
| 10 | + |
| 11 | +## Persona |
| 12 | + |
| 13 | +You are a C# developer specializing in PDF processing using Aspose.PDF for .NET, |
| 14 | +working within the **facades-sign-documents** category. |
| 15 | +This folder contains standalone C# examples for facades-sign-documents operations. |
| 16 | +See the root [agents.md](../agents.md) for repository-wide conventions and boundaries. |
| 17 | + |
| 18 | +## Scope |
| 19 | +- This folder contains examples for **facades-sign-documents**. |
| 20 | +- Files are standalone `.cs` examples stored directly in this folder. |
| 21 | + |
| 22 | +## Required Namespaces |
| 23 | + |
| 24 | +- `using Aspose.Pdf.Facades;` (34/34 files) ← category-specific |
| 25 | +- `using Aspose.Pdf.Forms;` (12/34 files) |
| 26 | +- `using Aspose.Pdf;` (10/34 files) |
| 27 | +- `using Aspose.Pdf.Text;` (1/34 files) |
| 28 | +- `using System;` (34/34 files) |
| 29 | +- `using System.IO;` (30/34 files) |
| 30 | +- `using System.Drawing;` (11/34 files) |
| 31 | +- `using System.Collections.Generic;` (3/34 files) |
| 32 | +- `using System.Globalization;` (2/34 files) |
| 33 | +- `using System.Security.Cryptography.X509Certificates;` (2/34 files) |
| 34 | +- `using System.Drawing.Imaging;` (1/34 files) |
| 35 | +- `using System.Linq;` (1/34 files) |
| 36 | +- `using System.Text;` (1/34 files) |
| 37 | +- `using System.Text.Json;` (1/34 files) |
| 38 | +- `using System.Threading;` (1/34 files) |
| 39 | + |
| 40 | +## Files in this folder |
| 41 | + |
| 42 | +| File | Title | Key APIs | Description | |
| 43 | +|------|-------|----------|-------------| |
| 44 | +| [add-image-signature-to-pdf](./add-image-signature-to-pdf.cs) | Add Image Signature to PDF | `PdfFileSignature`, `BindPdf`, `SignatureAppearance` | Demonstrates how to sign a PDF document with a visible image signature using Aspose.Pdf.Facades.P... | |
| 45 | +| [add-second-digital-signature-to-pdf](./add-second-digital-signature-to-pdf.cs) | Add a Second Digital Signature to a PDF Page | `PdfFileSignature`, `BindPdf`, `SetCertificate` | Shows how to apply a second digital signature on page three of an existing PDF using Aspose.Pdf.F... | |
| 46 | +| [add-signature-field-and-sign-pdf](./add-signature-field-and-sign-pdf.cs) | Add Signature Field and Sign PDF | `Document`, `SignatureField`, `PKCS1` | Demonstrates how to create a signature field on a specific page of a PDF and then digitally sign ... | |
| 47 | +| [check-absence-of-signatures-in-pdf](./check-absence-of-signatures-in-pdf.cs) | Check for Absence of Signatures in PDF | `PdfFileSignature`, `BindPdf`, `ContainsSignature` | Demonstrates using Aspose.Pdf.Facades.PdfFileSignature to confirm that a PDF contains no signatur... | |
| 48 | +| [custom-pdf-signature-appearance-no-caption](./custom-pdf-signature-appearance-no-caption.cs) | Create Custom PDF Signature Appearance Without Default Capti... | `PdfFileSignature`, `BindPdf`, `SetCertificate` | Demonstrates how to sign a PDF with a visible signature using Aspose.Pdf and hide the default "Di... | |
| 49 | +| [digitally-sign-first-page-pdf](./digitally-sign-first-page-pdf.cs) | Digitally Sign First Page of PDF | `PdfFileSignature`, `BindPdf`, `SetCertificate` | Shows how to create a PdfFileSignature, bind a PDF, set a certificate, add a visible digital sign... | |
| 50 | +| [extract-certificate-details-from-pdf-signature-fie...](./extract-certificate-details-from-pdf-signature-fields.cs) | Extract Certificate Details from PDF Signature Fields | `PdfFileSignature`, `BindPdf`, `GetSignatureNames` | Shows how to load a signed PDF, enumerate its signature fields, and retrieve the associated X.509... | |
| 51 | +| [extract-signature-certificate-serial-number](./extract-signature-certificate-serial-number.cs) | Extract and Log Signature Certificate Serial Number | `PdfFileSignature`, `BindPdf`, `ContainsSignature` | Shows how to open a PDF, verify it contains digital signatures, retrieve each signature's X.509 c... | |
| 52 | +| [extract-signature-images-html-report](./extract-signature-images-html-report.cs) | Extract Signature Images from PDF and Embed in HTML Report | `PdfFileSignature`, `BindPdf`, `GetSignatureNames` | Shows how to use Aspose.Pdf.Facades.PdfFileSignature to extract digital signature images from a P... | |
| 53 | +| [extract-signing-certificate-from-pdf](./extract-signing-certificate-from-pdf.cs) | Extract Signing Certificate from PDF Signature Field | `Document`, `PdfFileSignature`, `BindPdf` | Shows how to load a PDF, bind it to PdfFileSignature, extract the signing certificate from the 'L... | |
| 54 | +| [extract-witness-signature-to-png](./extract-witness-signature-to-png.cs) | Extract Signature Image and Save as PNG | `PdfFileSignature`, `BindPdf`, `ExtractImage` | Demonstrates how to extract the image from a PDF signature field using Aspose.Pdf.Facades and con... | |
| 55 | +| [list-pdf-signature-reason-location](./list-pdf-signature-reason-location.cs) | List PDF Signature Reason and Location | `PdfFileSignature`, `BindPdf`, `GetSignatureNames` | Shows how to open a PDF with Aspose.Pdf.Facades, retrieve all signature names, and extract each s... | |
| 56 | +| [list-signature-names-in-pdf](./list-signature-names-in-pdf.cs) | List Signature Names in a PDF | `PdfFileSignature`, `BindPdf`, `GetSignatureNames` | Shows how to bind a PDF document to the PdfFileSignature facade and retrieve the names of all act... | |
| 57 | +| [locale-specific-pdf-signature](./locale-specific-pdf-signature.cs) | Locale‑Specific PDF Signature Appearance | `PdfFileSignature`, `PKCS7`, `SignatureCustomAppearance` | Demonstrates signing a PDF with Aspose.Pdf using a PKCS7 signature and customizing the visual app... | |
| 58 | +| [log-pdf-signature-verification-to-json](./log-pdf-signature-verification-to-json.cs) | Log PDF Signature Verification Results to JSON | `PdfFileSignature`, `BindPdf`, `ContainsSignature` | Demonstrates how to verify digital signatures in a PDF using Aspose.Pdf and write each signature'... | |
| 59 | +| [pdf-signature-report](./pdf-signature-report.cs) | Generate PDF Signature Verification Report | `PdfFileSignature`, `BindPdf`, `GetSignatureNames` | Demonstrates how to read digital signatures from a PDF, verify each signature, and create a new P... | |
| 60 | +| [remove-all-signatures-from-pdf](./remove-all-signatures-from-pdf.cs) | Remove All Signatures from a PDF | `PdfFileSignature`, `BindPdf`, `GetSignatureNames` | Demonstrates how to use Aspose.Pdf's PdfFileSignature facade to enumerate and delete every digita... | |
| 61 | +| [remove-all-signatures-from-pdfs](./remove-all-signatures-from-pdfs.cs) | Remove All Signatures from PDFs Recursively | `PdfFileSignature`, `BindPdf`, `RemoveSignatures` | Shows how to recursively find PDF files in a directory and use Aspose.Pdf.Facades to strip all di... | |
| 62 | +| [remove-pdf-signature-missing-field](./remove-pdf-signature-missing-field.cs) | Remove PDF Signature with Missing-Field Handling | `PdfFileSignature`, `BindPdf`, `GetSignatureNames` | Demonstrates how to remove a specific digital signature from a PDF using Aspose.Pdf, while gracef... | |
| 63 | +| [remove-signature-from-pdf](./remove-signature-from-pdf.cs) | Remove Signature from PDF | `PdfFileSignature`, `BindPdf`, `RemoveSignature` | Demonstrates how to load a PDF, remove a signature named 'ApprovalSignature' using Aspose.Pdf, an... | |
| 64 | +| [remove-signatures-re-sign-pdf](./remove-signatures-re-sign-pdf.cs) | Remove Existing Signatures and Re‑sign PDF with a New Certif... | `PdfFileSignature`, `BindPdf`, `RemoveSignatures` | Demonstrates how to clear all existing signatures from a PDF and apply a new digital signature us... | |
| 65 | +| [retry-pdf-signing-when-file-locked](./retry-pdf-signing-when-file-locked.cs) | Retry PDF Signing When File Is Locked | `PdfFileSignature`, `BindPdf`, `SetCertificate` | Demonstrates how to sign a PDF using Aspose.Pdf.Facades with a retry mechanism that handles file‑... | |
| 66 | +| [sign-and-verify-pdf-using-pdffilesignature](./sign-and-verify-pdf-using-pdffilesignature.cs) | Sign and Verify PDF Using PdfFileSignature | `PdfFileSignature`, `BindPdf`, `Sign` | Demonstrates how to digitally sign a PDF with a PKCS#1 certificate using PdfFileSignature and the... | |
| 67 | +| [sign-pdf-french-caption](./sign-pdf-french-caption.cs) | Sign PDF with French Caption Using SignatureCustomAppearance | `PdfFileSignature`, `PKCS1`, `SignatureCustomAppearance` | Demonstrates how to digitally sign a PDF and set the signature appearance caption to French by co... | |
| 68 | +| [sign-pdf-hidden-signature](./sign-pdf-hidden-signature.cs) | Sign PDF with Hidden Signature Appearance | `PdfFileSignature`, `BindPdf`, `Sign` | Demonstrates digitally signing a PDF using Aspose.Pdf while completely hiding the signature appea... | |
| 69 | +| [sign-pdf-semi-transparent-background](./sign-pdf-semi-transparent-background.cs) | Sign PDF with Semi-Transparent Background Appearance | `PdfFileSignature`, `PKCS7`, `SignatureCustomAppearance` | Demonstrates how to digitally sign a PDF using Aspose.Pdf and configure a custom signature appear... | |
| 70 | +| [sign-pdf-suppress-signature-text](./sign-pdf-suppress-signature-text.cs) | Sign PDF and Suppress Signature Text | `PdfFileSignature`, `BindPdf`, `SetCertificate` | Demonstrates how to digitally sign a PDF using Aspose.Pdf.Facades and hide the default location, ... | |
| 71 | +| [sign-pdf-visible-signature-last-page](./sign-pdf-visible-signature-last-page.cs) | Sign PDF with Visible Signature on Last Page | `Document`, `Page`, `PdfFileSignature` | Shows how to apply a visible digital signature to the bottom‑right corner of the last page of a P... | |
| 72 | +| [sign-pdf-with-custom-appearance](./sign-pdf-with-custom-appearance.cs) | Sign PDF with Custom Appearance (Foreground Image & Backgrou... | `PdfFileSignature`, `PKCS1`, `SignatureCustomAppearance` | Demonstrates how to configure a SignatureCustomAppearance with a foreground image and background ... | |
| 73 | +| [sign-pdf-with-pfx-certificate](./sign-pdf-with-pfx-certificate.cs) | Sign PDF with PFX Certificate using Aspose.Pdf | `Document`, `PdfFileSignature`, `SetCertificate` | Demonstrates how to digitally sign a PDF document using a password‑protected PFX certificate with... | |
| 74 | +| ... | | | *and 4 more files* | |
| 75 | + |
| 76 | +## Category Statistics |
| 77 | +- Total examples: 34 |
| 78 | + |
| 79 | +## Category-Specific Tips |
| 80 | + |
| 81 | +### Key API Surface |
| 82 | +- `Aspose.Pdf.Document` |
| 83 | +- `Aspose.Pdf.Facades.Algorithm` |
| 84 | +- `Aspose.Pdf.Facades.DocMDPAccessPermissions` |
| 85 | +- `Aspose.Pdf.Facades.DocMDPSignature` |
| 86 | +- `Aspose.Pdf.Facades.DocumentPrivilege` |
| 87 | +- `Aspose.Pdf.Facades.KeySize` |
| 88 | +- `Aspose.Pdf.Facades.PKCS7` |
| 89 | +- `Aspose.Pdf.Facades.PdfFileInfo` |
| 90 | +- `Aspose.Pdf.Facades.PdfFileSecurity` |
| 91 | +- `Aspose.Pdf.Facades.PdfFileSecurity.BindPdf` |
| 92 | +- `Aspose.Pdf.Facades.PdfFileSecurity.EncryptFile` |
| 93 | +- `Aspose.Pdf.Facades.PdfFileSecurity.Save` |
| 94 | +- `Aspose.Pdf.Facades.PdfFileSignature` |
| 95 | +- `Aspose.Pdf.Facades.PdfFileSignature.BindPdf` |
| 96 | +- `Aspose.Pdf.Facades.PdfFileSignature.Certify` |
| 97 | + |
| 98 | +### Rules |
| 99 | +- Create a PdfFileInfo for {input_pdf} and read its IsEncrypted property to obtain a {bool} indicating whether the PDF is encrypted (password‑protected). |
| 100 | +- Use PdfFileInfo instead of loading a full Document when only document metadata such as encryption status is needed. |
| 101 | +- Instantiate PdfFileSecurity, call BindPdf({input_pdf}) to load the encrypted PDF, then invoke DecryptFile({string_literal}) with the owner password to decrypt it. |
| 102 | +- After decryption, call Save({output_pdf}) on the PdfFileSecurity instance to write the unprotected PDF to disk. |
| 103 | +- Instantiate {class} (PdfFileSecurity), call BindPdf({input_pdf}) to load the document, then invoke ChangePassword({owner_password}, {new_user_password}, {new_owner_password}) to set new passwords, and finally Save({output_pdf}) to write the protected file. |
| 104 | + |
| 105 | +### Warnings |
| 106 | +- DecryptFile requires the owner password; decryption with only a user password is not covered by this example. |
| 107 | +- The example assumes the PDF is protected with an owner password; if the PDF has no password, an empty string may be required for the current owner password. |
| 108 | +- PdfFileSecurity belongs to the Aspose.Pdf.Facades namespace, which may be deprecated in future releases; consider using the newer Aspose.Pdf.Security namespace if available. |
| 109 | +- A valid PKCS#7 certificate file and correct password are required; otherwise signing will fail. |
| 110 | +- Custom appearance may not be rendered identically across all PDF viewers. |
| 111 | + |
| 112 | +## General Tips |
| 113 | +- See parent [agents.md](../agents.md) for: |
| 114 | + - **Boundaries** — Always / Ask First / Never rules for all examples |
| 115 | + - **Common Mistakes** — verified anti-patterns that cause build failures |
| 116 | + - **Domain Knowledge** — cross-cutting API-specific gotchas |
| 117 | + - **Testing Guide** — build and run verification steps |
| 118 | +- Review code examples in this folder for facades-sign-documents patterns |
| 119 | + |
| 120 | +<!-- AUTOGENERATED:START --> |
| 121 | +Updated: 2026-05-08 | Run: `20260508_144637_f72c91` |
| 122 | +<!-- AUTOGENERATED:END --> |
0 commit comments