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

agentic-net-examples / working-with-annotations

AGENTS.md2 starsChanged 4 months agoMITView on GitHub

C# examples for working-with-annotations using Aspose.PDF for .NET

The file

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

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    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:

    Create a screen annotation using {annotation} = new ScreenAnnotation({page}, {rect}, {string_literal}) where {string_literal} points to a …

    line 121

≈ “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 - working-with-annotations

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

Scope

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

Required Namespaces

  • using Aspose.Pdf; (157/157 files) ← category-specific
  • using Aspose.Pdf.Annotations; (130/157 files) ← category-specific
  • using Aspose.Pdf.Text; (15/157 files)
  • using Aspose.Pdf.Forms; (10/157 files)
  • using Aspose.Pdf.Drawing; (5/157 files)
  • using Aspose.Pdf.Facades; (2/157 files)
  • using Aspose.Pdf.Devices; (1/157 files)
  • using System; (157/157 files)
  • using System.IO; (155/157 files)
  • using System.Collections.Generic; (14/157 files)
  • using System.Drawing; (5/157 files)
  • using System.Linq; (2/157 files)
  • using System.Threading.Tasks; (2/157 files)
  • using Azure.Storage.Blobs; (1/157 files)
  • using System.Net.Http; (1/157 files)
  • using System.Net.Http.Headers; (1/157 files)
  • using System.Text; (1/157 files)
  • using System.Text.Json; (1/157 files)
  • using System.Xml; (1/157 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-3d-annotation-front-viewAdd 3D Annotation with Front View to PDFDocument, PDF3DContent, PDF3DArtworkShows how to embed a U3D/PRC 3‑D model into a PDF, create a 3‑D annotation, define a front‑facing...
add-3d-annotation-with-custom-cameraAdd 3D Annotation with Custom Camera to PDFDocument, PDF3DContent, PDF3DArtworkShows how to embed a 3D model into a PDF and define a custom camera view using Aspose.Pdf 3D anno...
add-3d-u3d-annotation-initial-view-page-twoAdd 3D U3D Annotation with Initial View on Page TwoDocument, LoadAsU3D, PDF3DArtworkShows how to embed a U3D model as a 3D annotation in a PDF, define an initial camera view, and pl...
add-animated-gif-screen-annotationAdd Animated GIF Screen Annotation to PDF PageDocument, Page, RectangleDemonstrates how to place a ScreenAnnotation that shows an animated GIF, looping continuously, on...
add-automatic-background-music-to-pdfAdd Automatic Background Music to PDFDocument, Page, RichMediaAnnotationDemonstrates how to embed an MP3 audio file as a RichMediaAnnotation that automatically plays whe...
add-background-image-artifact-to-pdf-pageAdd Background Image Artifact to PDF PageDocument, Page, BackgroundArtifactDemonstrates how to create a BackgroundArtifact from an image file and attach it to a page's Arti...
add-bates-numbering-with-prefixAdd Bates Numbering Artifact with Prefix to PDFDocument, AddBatesNumbering, BatesNArtifactDemonstrates how to add a Bates numbering artifact with a custom "ABC" prefix and a six‑digit for...
add-button-annotation-go-to-page-10Add Button Annotation to Navigate to Page 10Document, Page, RectangleShows how to create a button form field that jumps to page 10 of the same PDF when activated, usi...
add-button-annotation-highlight-text-fieldsCreate Button Annotation to Highlight Text FieldsDocument, Page, RectangleShows how to add a push‑button annotation to a PDF page with Aspose.Pdf, attach a JavaScript acti...
add-callout-leader-line-to-freetext-annotationAdd Callout Leader Line to Free-Text AnnotationDocument, Page, FreeTextAnnotationDemonstrates creating a FreeTextAnnotation with a callout leader line by configuring the Callout ...
add-diagonal-watermark-annotationAdd Diagonal Watermark Annotation to PDFDocument, Page, RectangleDemonstrates how to place a WatermarkAnnotation diagonally across a PDF page using a rectangle ge...
add-dynamic-date-watermark-to-pdf-pagesAdd Dynamic Date Watermark to PDF PagesDocument, Page, WatermarkAnnotationDemonstrates how to add a WatermarkAnnotation with a runtime‑generated date string to each page o...
add-dynamic-page-number-watermarkAdd Dynamic Page Number Watermark to PDFDocument, Page, WatermarkAnnotationShows how to create a WatermarkAnnotation that displays the current page number on each page of a...
add-external-url-link-annotationAdd External URL Link Annotation to PDFDocument, Page, RectangleShows how to create a link annotation that opens an external website when the user clicks the ann...
add-figure-annotation-around-tableAdd Figure Annotation Around a Detected TableDocument, TableAbsorber, RectangleDemonstrates how to use TableAbsorber to locate a table on a PDF page and draw a square (figure) ...
add-figure-annotation-external-imageAdd Figure Annotation Referencing External ImageDocument, Page, RectangleDemonstrates how to create a FileAttachment (figure) annotation in a PDF that uses an external im...
add-footer-watermark-to-pdf-pagesAdd Footer Watermark to PDF PagesDocument, Page, RectangleDemonstrates loading a PDF with Aspose.Pdf, iterating through each page, and adding a WatermarkAn...
add-free-text-annotation-arialAdd Free‑Text Annotation with Arial Font to PDFDocument, Page, RectangleDemonstrates how to create a free‑text annotation on a PDF page using Arial, 12‑point font, and s...
add-free-text-annotation-with-calloutAdd Free‑Text Annotation with Callout to PDFDocument, Page, RectangleDemonstrates how to load a PDF, create a free‑text annotation with a callout line, set its appear...
add-highlight-annotation-70-opacityAdd Highlight Annotation with 70% Opacity to PDFDocument, HighlightAnnotation, RectangleShows how to load a PDF, create a highlight annotation with 70% opacity, set its color, add it to...
add-highlight-annotation-with-opacityAdd Highlight Annotation with Custom Opacity to PDFDocument, Page, RectangleShows how to load a PDF, create a highlight annotation with a specific color and opacity, add it ...
add-highres-pdf-page-as-tiled-backgroundAdd High-Resolution PDF Page as Tiled BackgroundDocument, Page, BackgroundArtifactShows how to use Aspose.Pdf's BackgroundArtifact to set a high‑resolution PDF page as a tiled bac...
add-internal-link-annotation-to-pdfAdd Internal Link Annotation to PDFDocument, Page, RectangleShows how to create a link annotation that navigates to a specific page within the same PDF docum...
add-javascript-button-annotation-to-pdf-pageAdd JavaScript Button Annotation to PDF PageDocument, Page, RectangleDemonstrates how to create a push button on page 4 of a PDF and attach a JavaScript action that s...
add-javascript-link-annotation-modal-dialogAdd JavaScript Link Annotation to Show Modal DialogDocument, Page, RectangleShows how to create a link annotation with a JavaScript action that displays a custom modal dialo...
add-javascript-link-annotationAdd JavaScript Link Annotation to Open URLDocument, Page, RectangleDemonstrates how to add a link annotation with a JavaScript action that opens a URL in a new brow...
add-magenta-underline-annotationAdd Magenta Underline Annotation to PDFDocument, Page, RectangleDemonstrates how to add an underline annotation with magenta color and a 2‑point border to a PDF ...
add-polyline-figure-annotationAdd Polyline Figure Annotation to PDFDocument, Page, RectangleShows how to insert a custom polyline figure annotation onto a PDF page with Aspose.Pdf, defining...
add-polyline-figure-annotation__v2Add Polyline Figure Annotation to PDFDocument, Page, RectangleShows how to create a polyline figure annotation from a list of points and add it to a PDF page u...
add-popup-annotation-to-pdfAdd Popup Annotation Linked to a Sticky NoteDocument, Page, TextAnnotationDemonstrates how to create a TextAnnotation (sticky note) and a linked PopupAnnotation in a PDF u...
...and 127 more files

Category Statistics

  • Total examples: 157

Category-Specific Tips

Key API Surface

  • Aspose.Pdf.AnnotationCollection
  • Aspose.Pdf.AnnotationCollection.Delete
  • Aspose.Pdf.Annotations.Annotation
  • Aspose.Pdf.Annotations.AnnotationFlags
  • Aspose.Pdf.Annotations.DefaultAppearance
  • Aspose.Pdf.Annotations.FreeTextAnnotation
  • Aspose.Pdf.Annotations.MarkupAnnotation
  • Aspose.Pdf.Annotations.ScreenAnnotation
  • Aspose.Pdf.Annotations.TextAnnotation
  • Aspose.Pdf.Annotations.TextMarkupAnnotation
  • Aspose.Pdf.Annotations.TextStyle
  • Aspose.Pdf.Document
  • Aspose.Pdf.Document.Save
  • Aspose.Pdf.Facades.PdfAnnotationEditor
  • Aspose.Pdf.Facades.PdfAnnotationEditor.BindPdf

Rules

  • BindPdf({input_pdf}) must be called on a PdfContentEditor instance before any annotation operations.
  • CreateFreeText({rect}, {string_literal}, {int}) adds a free‑text annotation containing the given text to the specified page number within the bound document.
  • Save({output_pdf}) persists all changes made to the PDF after annotation creation.
  • Load a PDF document with {doc} = new Document({input_pdf});
  • Create a screen annotation using {annotation} = new ScreenAnnotation({page}, {rect}, {string_literal}) where {string_literal} points to a .swf file.

Warnings

  • The rectangle coordinates are expressed in points relative to the page's origin (bottom‑left).
  • Page numbers are 1‑based; passing an invalid page index will throw an exception.
  • SWF (Flash) content may not be supported by all PDF viewers; ensure target environment can render it.
  • The rectangle coordinates must be within the bounds of {page} to be visible.
  • The exact class name for the annotations collection is assumed to be Aspose.Pdf.AnnotationCollection; verify against the library version.

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 working-with-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.