agentleFS
aspose-pdfaspose-pdf/agentic-net-examples/facades-annotations/AGENTS.md

agentic-net-examples / facades-annotations

AGENTS.md2 starsChanged 4 months agoMITView on GitHub

C# examples for facades-annotations using Aspose.PDF for .NET

The file

We split this AGENTS.md into the rules it gives an agent

2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    After adding the annotation, persist the changes by invoking Save({output_pdf}) on the same PdfContentEditor instance.

    line 118
  2. Distinctive:

    Only FreeText and Line annotation types are shown.

    line 127

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS - facades-annotations

Facades annotations in PDF using C# / .NET -- 105 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 facades-annotations category. This folder contains standalone C# examples for facades-annotations operations. See the root agents.md for repository-wide conventions and boundaries.

Scope

  • This folder contains examples for facades-annotations.
  • Files are standalone .cs examples stored directly in this folder.

Required Namespaces

  • using Aspose.Pdf.Facades; (103/105 files) ← category-specific
  • using Aspose.Pdf; (66/105 files) ← category-specific
  • using Aspose.Pdf.Annotations; (45/105 files)
  • using Aspose.Pdf.Drawing; (2/105 files)
  • using Aspose.Pdf.Text; (2/105 files)
  • using System; (105/105 files)
  • using System.IO; (95/105 files)
  • using System.Collections.Generic; (17/105 files)
  • using System.Diagnostics; (4/105 files)
  • using System.Linq; (4/105 files)
  • using System.Threading.Tasks; (4/105 files)
  • using System.Threading; (3/105 files)
  • using System.Text; (2/105 files)
  • using System.Xml; (2/105 files)
  • using System.Xml.Linq; (2/105 files)
  • using Azure.Storage.Blobs; (1/105 files)
  • using Azure.Storage.Blobs.Models; (1/105 files)
  • using Microsoft.VisualStudio.TestTools.UnitTesting; (1/105 files)
  • using System.IO.Compression; (1/105 files)
  • using System.Runtime.CompilerServices; (1/105 files)
  • using System.Text.Json; (1/105 files)
  • using System.Xml.Schema; (1/105 files)

Common Code Pattern

Most files in this category use PdfAnnotationEditor from Aspose.Pdf.Facades:

PdfAnnotationEditor tool = new PdfAnnotationEditor();
tool.BindPdf("input.pdf");
// ... PdfAnnotationEditor operations ...
tool.Save("output.pdf");

Files in this folder

FileTitleKey APIsDescription
add-custom-metadata-to-pdf-annotationAdd Custom Metadata to a PDF AnnotationDocument, Page, TextAnnotationDemonstrates how to create a TextAnnotation, store custom key/value metadata using PdfFileInfo, o...
add-text-annotation-with-custom-flagsAdd Text Annotation with Custom Flags to PDFPdfAnnotationEditor, TextAnnotation, AnnotationFlagsDemonstrates creating a TextAnnotation, setting custom annotation flags (Invisible, NoZoom), and ...
annotation-removal-reportAnnotation Removal Report for PDFsDocument, Page, PdfAnnotationEditorDemonstrates how to count and delete all annotations from multiple PDF files using Aspose.Pdf and...
async-pdf-annotation-operationsAsynchronous PDF Annotation Operations with Aspose.PdfPdfAnnotationEditor, BindPdf, FlatteningAnnotationsDemonstrates how to perform common PDF annotation tasks—flattening, deleting, importing, and expo...
backup-pdf-and-flatten-form-fieldsBackup PDF and Flatten Form FieldsDocument, Form, FlattenAllFieldsDemonstrates how to create a backup of a PDF before flattening all interactive form fields using ...
batch-delete-pdf-annotations-azure-blobBatch Delete PDF Annotations from Azure Blob StoragePdfAnnotationEditor, BindPdf, DeleteAnnotationsDemonstrates how to enumerate PDF blobs in an Azure Blob container, stream each PDF into Aspose.P...
batch-delete-pdf-annotations-retain-typesBatch Delete PDF Annotations While Retaining Specified TypesPdfAnnotationEditor, AnnotationType, BindPdfDemonstrates how to load a PDF, read a JSON configuration that lists annotation types to keep, an...
batch-delete-pdf-annotations-with-progressBatch Delete PDF Annotations with ProgressPdfAnnotationEditor, BindPdf, DeleteAnnotationsDemonstrates how to remove all annotations from multiple PDF files using Aspose.Pdf.Facades.PdfAn...
batch-delete-stamp-annotationsBatch Delete Stamp Annotations from PDFsPdfAnnotationEditor, BindPdf, DeleteAnnotationsDemonstrates how to iterate through PDF files in a folder and remove all stamp annotations using ...
batch-export-delete-annotations-xfdfBatch Export Annotations to XFDF and Remove ThemPdfAnnotationEditor, BindPdf, ExportAnnotationsToXfdfShows how to process a folder of PDFs, export all annotations to XFDF files for archiving, delete...
batch-flatten-pdf-annotations-cancellationBatch Flatten PDF Annotations with Cancellation SupportDocument, PdfAnnotationEditor, BindPdfDemonstrates flattening all annotations in multiple PDF files using Aspose.Pdf's PdfAnnotationEdi...
batch-flatten-pdf-annotationsBatch Flatten PDF AnnotationsPdfAnnotationEditor, BindPdf, FlatteningAnnotationsProcesses every PDF in a specified folder, flattens all annotations using Aspose.Pdf's PdfAnnotat...
batch-import-xfdf-annotations-into-pdfsBatch Import XFDF Annotations into Matching PDFsDocument, PdfAnnotationEditor, BindPdfDemonstrates iterating over PDF files, locating corresponding XFDF files by name, importing their...
batch-remove-old-annotationsBatch Remove Old Annotations from PDFsPdfAnnotationEditor, BindPdf, SaveDemonstrates how to iterate through PDFs in a folder and delete annotations whose modification da...
batch-update-annotation-authorBatch Update Annotation Author Across Multiple PDFsPdfAnnotationEditor, BindPdf, ModifyAnnotationsAuthorShows how to iterate through PDF files in a directory and use PdfAnnotationEditor to replace the ...
benchmark-delete-annotationsBenchmark Deleting PDF Annotations with Aspose.PdfDocument, Page, TextAnnotationCreates a PDF with multiple text annotations and measures the performance of deleting all annotat...
check-duplicate-annotation-namesCheck for Duplicate Annotation Names in a PDFPdfAnnotationEditor, Document, PageShows how to iterate through all annotations in a PDF with Aspose.Pdf, detect duplicate annotatio...
clone-annotation-change-colorClone PDF Annotation, Change Its Color, and Add to Another P...Document, Page, AnnotationDemonstrates how to load a PDF, clone an existing annotation, modify its color, and place the clo...
clone-modify-pdf-annotationClone and Modify PDF AnnotationPdfAnnotationEditor, BindPdf, SaveShows how to clone an existing annotation on a PDF page, change its properties, and add the clone...
concurrent-insert-delete-pdfConcurrent Insert and Delete Operations on a PDFPdfFileEditor, TryInsert, TryDeleteDemonstrates how to safely perform simultaneous page insertions and deletions on the same PDF usi...
conditional-pdf-flatteningConditional PDF Flattening Based on Digital SignaturesDocument, PdfFileSignature, BindPdfThe example checks if a PDF contains digital signatures using PdfFileSignature and only flattens ...
copy-annotations-to-multiple-pdfsCopy Annotations from Template PDF to Multiple PDFsPdfAnnotationEditor, Document, PageDemonstrates exporting annotations from a template PDF to an XFDF stream and importing them into ...
delete-all-annotations-from-pdfDelete All Annotations from PDF and Verify CountPdfAnnotationEditor, BindPdf, DeleteAnnotationsShows how to bind a PDF with PdfAnnotationEditor, count existing annotations, remove them using D...
delete-annotations-by-authorDelete Annotations by Author Using Aspose.PdfDocument, Page, AnnotationShows how to filter PDF annotations by the author's Title and remove them using PdfAnnotationEditor.
delete-annotations-export-xfdfDelete Specific Annotations and Export Remaining to XFDFPdfAnnotationEditor, BindPdf, DeleteAnnotationsDemonstrates how to remove all annotations of a given type (e.g., Text) from a PDF using PdfAnnot...
delete-annotations-from-pdf-using-configDelete Specific Annotations from PDF Using Configuration Fil...PdfAnnotationEditor, BindPdf, DeleteAnnotationsShows how to read annotation types from a text configuration file and delete those (or all) annot...
delete-annotations-from-pdfDelete All Annotations from PDF Using PdfAnnotationEditorDocument, Page, TextAnnotationShows how to create a PDF with text annotations, remove them with PdfAnnotationEditor.DeleteAnnot...
delete-annotations-with-backupDelete All Annotations with Optional BackupDocument, PdfAnnotationEditor, DeleteAnnotationsDemonstrates how to create a backup copy of a PDF before removing all annotations using Aspose.Pd...
delete-flatten-pdf-annotationsDelete and Flatten PDF AnnotationsPdfAnnotationEditor, BindPdf, DeleteAnnotationsDemonstrates using Aspose.Pdf.Facades.PdfAnnotationEditor to remove all annotations from a PDF, f...
delete-pdf-annotation-by-nameDelete a PDF Annotation by NamePdfAnnotationEditor, BindPdf, DeleteAnnotationShows how to remove a specific annotation identified by its name from a PDF using Aspose.Pdf.Faca...
...and 75 more files

Category Statistics

  • Total examples: 105

Category-Specific Tips

Key API Surface

  • Aspose.Pdf.Annotations.AnnotationType
  • Aspose.Pdf.Facades.PdfAnnotationEditor
  • Aspose.Pdf.Facades.PdfAnnotationEditor.BindPdf
  • Aspose.Pdf.Facades.PdfAnnotationEditor.BindPdf(string)
  • Aspose.Pdf.Facades.PdfAnnotationEditor.DeleteAnnotations()
  • Aspose.Pdf.Facades.PdfAnnotationEditor.DeleteAnnotations(string)
  • Aspose.Pdf.Facades.PdfAnnotationEditor.ExportAnnotationsXfdf
  • Aspose.Pdf.Facades.PdfAnnotationEditor.Save
  • Aspose.Pdf.Facades.PdfAnnotationEditor.Save(string)
  • Aspose.Pdf.Facades.PdfContentEditor
  • Aspose.Pdf.Facades.PdfContentEditor.BindPdf
  • Aspose.Pdf.Facades.PdfContentEditor.CreateFileAttachment
  • Aspose.Pdf.Facades.PdfContentEditor.Save

Rules

  • Instantiate Aspose.Pdf.Facades.PdfContentEditor, bind the source PDF via BindPdf({input_pdf}), then call CreateFileAttachment({rect}, {string_literal}, {string_literal}, {int}, {string_literal}, {float}) where the parameters are the annotation rectangle, description, attached file path, page number, icon name, and icon transparency.
  • After adding the annotation, persist the changes by invoking Save({output_pdf}) on the same PdfContentEditor instance.
  • To delete all annotations: instantiate {class:PdfAnnotationEditor}, call BindPdf({input_pdf}), invoke DeleteAnnotations(), then Save({output_pdf}).
  • PdfAnnotationEditor must be bound to a PDF via BindPdf before any annotation‑related methods (e.g., DeleteAnnotations) can be used.
  • Bind a PDF file ({input_pdf}) to a PdfAnnotationEditor instance using BindPdf before any annotation operations.

Warnings

  • The example uses System.Drawing.Rectangle for the annotation bounds, which requires a reference to System.Drawing.Common on non‑Windows platforms.
  • Transparency support may depend on the chosen icon and PDF viewer.
  • The example does not use a using statement for FileStream; callers should ensure proper disposal.
  • Only FreeText and Line annotation types are shown; other types can be included by adding their string names to the array.

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 facades-annotations 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.