agentleFS
aspose-pdfaspose-pdf/agentic-net-examples/securing-and-signing-pdf/AGENTS.md

agentic-net-examples / securing-and-signing-pdf

AGENTS.md2 starsChanged 4 months agoMITView on GitHub

C# examples for securing-and-signing-pdf using Aspose.PDF for .NET

The file

Files
AGENTS.md

AGENTS - securing-and-signing-pdf

Securing and signing PDF in PDF using C# / .NET -- 78 verified, compile-tested examples for Aspose.PDF for .NET 26.8.0. Each .cs file is a standalone, build-validated console example, generated and runtime-checked by an AI agent before publishing.

Persona

You are a C# developer specializing in PDF processing using Aspose.PDF for .NET, working within the securing-and-signing-pdf category. This folder contains standalone C# examples for securing-and-signing-pdf operations. See the root agents.md for repository-wide conventions and boundaries.

Scope

  • This folder contains examples for securing-and-signing-pdf.
  • Files are standalone .cs examples stored directly in this folder.

Required Namespaces

  • using Aspose.Pdf; (78/78 files) ← category-specific
  • using Aspose.Pdf.Forms; (52/78 files) ← category-specific
  • using Aspose.Pdf.Security; (9/78 files)
  • using Aspose.Pdf.Annotations; (4/78 files)
  • using Aspose.Pdf.Drawing; (2/78 files)
  • using Aspose.Pdf.Signatures; (2/78 files)
  • using Aspose.Pdf.Text; (1/78 files)
  • using System; (78/78 files)
  • using System.IO; (78/78 files)
  • using System.Security.Cryptography.X509Certificates; (16/78 files)
  • using System.Collections.Generic; (5/78 files)
  • using System.Linq; (4/78 files)
  • using System.Security.Cryptography; (3/78 files)
  • using Azure.Storage.Blobs; (1/78 files)
  • using System.Drawing.Imaging; (1/78 files)
  • using System.IO.Compression; (1/78 files)
  • using System.Net.Http; (1/78 files)
  • using System.Text; (1/78 files)
  • using System.Threading; (1/78 files)
  • using System.Threading.Tasks; (1/78 files)
  • using System.Xml; (1/78 files)

Common Code Pattern

Most files follow this pattern:

using (Document doc = new Document("input.pdf"))
{
    // ... operations ...
    doc.Save("output.pdf");
}

Files in this folder

FileTitleKey APIsDescription
add-invisible-digital-signature-to-pdfAdd Invisible Digital Signature to PDFDocument, Page, RectangleShows how to create an invisible digital signature field, sign it with a PKCS#7 certificate, reco...
add-new-empty-signature-fieldAdd a New Empty Signature Field to a PDFDocument, SignatureField, RectangleThe example loads a PDF, lists any existing signature fields, creates a new empty signature field...
add-visible-digital-signature-second-pageAdd Visible Digital Signature to Second Page of PDFDocument, Page, RectangleDemonstrates how to place a visible digital signature in the bottom‑right corner of the second pa...
apply-pkcs7-detached-digital-signatureApply PKCS#7 Detached Digital Signature to PDFDocument, SignatureField, PKCS7DetachedDemonstrates loading a PDF from a file stream, adding a signature field, and applying a PKCS#7 de...
batch-decrypt-pdfs-lookup-tableBatch Decrypt Password-Protected PDFs Using a Lookup TableDocument, Document(string, string), DecryptDemonstrates iterating over a folder of encrypted PDFs, trying multiple possible passwords from a...
batch-encrypt-and-sign-pdfsBatch Encrypt and Digitally Sign PDFsDocument, Permissions, CryptoAlgorithmDemonstrates how to encrypt multiple PDF files with AES‑256 and then apply a PKCS#7 digital signa...
batch-encrypt-pdfs-archive-zipBatch Encrypt PDFs and Archive to ZIPDocument, Encrypt, SaveDemonstrates how to encrypt multiple PDF files with unique passwords using Aspose.Pdf and then pa...
batch-encrypt-pdfs-by-filenameBatch Encrypt PDFs Using File Name PasswordsDocument, Permissions, CryptoAlgorithmIterates through all PDF files in a folder, derives a password from each file name, encrypts each...
batch-encrypt-pdfs-date-passwordBatch Encrypt PDFs with Date-Based PasswordsDocument, Permissions, CryptoAlgorithmDemonstrates how to encrypt multiple PDF files in a folder using Aspose.Pdf, generating a unique ...
batch-sign-and-compress-pdfsBatch Sign and Compress PDFsDocument, SignatureField, PKCS7Demonstrates how to iterate over a folder of PDF files, add a digital signature field, sign each ...
batch-sign-pdfs-title-based-certificate-selectionBatch Sign PDFs with Title-Based Certificate SelectionDocument, DocumentInfo, PKCS7Loads PDFs from a folder, selects a certificate based on the document title, creates a PKCS7 sign...
batch-sign-pdfs-with-certificate-per-document-typeBatch Sign PDFs with Certificate per Document TypeDocument, Info, SignatureFieldLoads PDF files from an input folder, determines a document type from the PDF title, retrieves th...
batch-sign-pdfs-with-certificateBatch Sign PDFs with Certificate and TimestampDocument, Page, RectangleDemonstrates how to iterate over PDF files in a folder and apply a PKCS#7 digital signature using...
certified-pdf-signature-allow-add-pagesCreate a Certified PDF Signature Allowing Page AdditionsDocument, Rectangle, SignatureFieldDemonstrates how to add a certification (MDP) signature to a PDF using Aspose.Pdf so that new pag...
custom-security-handler-logging-pdf-accessCustom Security Handler for Logging PDF Access AttemptsDocument, ICustomSecurityHandler, PermissionsDemonstrates how to implement a custom ICustomSecurityHandler that logs password checks and encry...
custom-security-handler-warning-overlayCustom Security Handler with Warning OverlayDocument, Permissions, EncryptShows how to attach a custom ICustomSecurityHandler to a PDF to disable copy‑paste permissions an...
decrypt-pdf-extract-embedded-imagesDecrypt PDF and Extract Embedded ImagesDocument, Decrypt(), Save()Shows how to open an encrypted PDF with a user password, remove its encryption, and extract all e...
decrypt-pdf-extract-images-reencryptDecrypt PDF, Extract Images, and Re‑encrypt with New Owner P...Document, Decrypt, PageThe example opens an encrypted PDF using a known password, decrypts it, extracts all embedded ima...
decrypt-pdf-sign-fields-multiple-certsDecrypt PDF and Sign Each Signature Field with Different Cer...Document, Decrypt, SignatureFieldThe example opens an encrypted PDF, removes its protection, locates all signature fields, and sig...
decrypt-pdf-update-metadataDecrypt PDF and Update Metadata with Aspose.PdfDocument, Decrypt, InfoDemonstrates how to open an encrypted PDF using the owner password, remove its encryption, modify...
decrypt-pdf-with-certificate-tokenDecrypt PDF Encrypted with Certificate Using Hardware TokenDocument, CertificateEncryptionOptions, DecryptShows how to open a PDF encrypted with a public certificate, retrieve the private key from a hard...
decrypt-pdf-with-owner-passwordDecrypt PDF with Owner Password using Aspose.PdfDocument, Decrypt, SaveDemonstrates opening an encrypted PDF with the owner password, removing its protection, and savin...
download-sign-pdf-azure-blobDownload PDF, Apply PKCS7 Signature, and Upload to Azure Blo...Document, Page, RectangleThe example downloads a PDF from a URL, creates a signature field, signs it with a PKCS7 certific...
encrypt-pdf-aes256-user-owner-passwordsEncrypt PDF with AES‑256 and Set User/Owner PasswordsDocument, Permissions, CryptoAlgorithmDemonstrates how to encrypt a PDF using AES‑256, assign separate user and owner passwords, and co...
encrypt-pdf-allow-copy-block-printEncrypt PDF and Allow Copying While Blocking PrintingDocument, Permissions, CryptoAlgorithmShows how to encrypt a PDF with Aspose.Pdf, set user and owner passwords, permit content extracti...
encrypt-pdf-disable-content-extractionEncrypt PDF and Disable Content ExtractionDocument, Permissions, CryptoAlgorithmLoads a PDF, encrypts it with AES‑256 using user and owner passwords, sets permissions to none to...
encrypt-pdf-disable-printingEncrypt PDF with Password and Disable PrintingDocument, Encrypt, SaveDemonstrates how to encrypt a PDF using AES‑256 with user and owner passwords while restricting p...
encrypt-pdf-owner-password-high-res-printingEncrypt PDF with Owner Password and Allow High‑Resolution Pr...Document, Permissions, CryptoAlgorithmThe example loads a PDF, applies AES‑256 encryption with an owner password, enables high‑resoluti...
encrypt-pdf-print-only-permissionEncrypt PDF with Print‑Only PermissionDocument, Permissions, CryptoAlgorithmShows how to encrypt a PDF using Aspose.Pdf and restrict its permissions so that only printing is...
encrypt-pdf-rc4-128-bit-restrict-editingEncrypt PDF with RC4 128-bit and Restrict EditingDocument, Permissions, CryptoAlgorithmThe example loads a PDF, applies 128‑bit RC4 encryption with user and owner passwords, restricts ...
...and 48 more files

Category Statistics

  • Total examples: 78

General Tips

  • See parent AGENTS.md for:
    • Boundaries -- Always / Ask First / Never rules for all examples
    • Common Mistakes -- verified anti-patterns that cause build failures
    • Domain Knowledge -- cross-cutting API-specific gotchas
    • Testing Guide -- build and run verification steps
  • Review code examples in this folder for securing-and-signing-pdf patterns
<!-- AUTOGENERATED:START -->

Updated: 2026-08-20 | Run: 20260820_001147_12d7b3

<!-- AUTOGENERATED:END -->

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.