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
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository36 other files it gives its agents.
- accessibility-and-tagged-pdfsAGENTS.md
- aspose-pdf-examplesAGENTS.md
- basic-operationsAGENTS.md
- compare-pdfAGENTS.md
- conversionAGENTS.md
- documentAGENTS.md
- facades-acroformsAGENTS.md
- facades-annotationsAGENTS.md
- facades-bookmarksAGENTS.md
- facades-convert-documentsAGENTS.md
- facades-documentsAGENTS.md
- facades-edit-documentAGENTS.md
- facades-extract-images-and-textAGENTS.md
- facades-fill-formsAGENTS.md
- facades-formsAGENTS.md
- facades-metadataAGENTS.md
- facades-pagesAGENTS.md
- facades-secure-documentsAGENTS.md
- facades-sign-documentsAGENTS.md
- facades-stampsAGENTS.md
- facades-texts-and-imagesAGENTS.md
- facades-xmp-metadataAGENTS.md
- graphs-zugferd-operatorsAGENTS.md
- pagesAGENTS.md
- parse-pdfAGENTS.md
- securing-and-signing-pdfAGENTS.md
- stampingAGENTS.md
- uncategorizedAGENTS.md
- working-with-attachmentsAGENTS.md
- working-with-formsAGENTS.md
- working-with-graphsAGENTS.md
- working-with-imagesAGENTS.md
- working-with-tablesAGENTS.md
- working-with-textAGENTS.md
- working-with-xmlAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
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
- Distinctive: line 121
Create a screen annotation using {annotation} = new ScreenAnnotation({page}, {rect}, {string_literal}) where {string_literal} points to a …
≈ “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.
Files
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
.csfile 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
.csexamples stored directly in this folder.
Required Namespaces
using Aspose.Pdf;(157/157 files) ← category-specificusing Aspose.Pdf.Annotations;(130/157 files) ← category-specificusing 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
| File | Title | Key APIs | Description |
| add-3d-annotation-front-view | Add 3D Annotation with Front View to PDF | Document, PDF3DContent, PDF3DArtwork | Shows 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-camera | Add 3D Annotation with Custom Camera to PDF | Document, PDF3DContent, PDF3DArtwork | Shows 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-two | Add 3D U3D Annotation with Initial View on Page Two | Document, LoadAsU3D, PDF3DArtwork | Shows how to embed a U3D model as a 3D annotation in a PDF, define an initial camera view, and pl... |
| add-animated-gif-screen-annotation | Add Animated GIF Screen Annotation to PDF Page | Document, Page, Rectangle | Demonstrates how to place a ScreenAnnotation that shows an animated GIF, looping continuously, on... |
| add-automatic-background-music-to-pdf | Add Automatic Background Music to PDF | Document, Page, RichMediaAnnotation | Demonstrates how to embed an MP3 audio file as a RichMediaAnnotation that automatically plays whe... |
| add-background-image-artifact-to-pdf-page | Add Background Image Artifact to PDF Page | Document, Page, BackgroundArtifact | Demonstrates how to create a BackgroundArtifact from an image file and attach it to a page's Arti... |
| add-bates-numbering-with-prefix | Add Bates Numbering Artifact with Prefix to PDF | Document, AddBatesNumbering, BatesNArtifact | Demonstrates how to add a Bates numbering artifact with a custom "ABC" prefix and a six‑digit for... |
| add-button-annotation-go-to-page-10 | Add Button Annotation to Navigate to Page 10 | Document, Page, Rectangle | Shows how to create a button form field that jumps to page 10 of the same PDF when activated, usi... |
| add-button-annotation-highlight-text-fields | Create Button Annotation to Highlight Text Fields | Document, Page, Rectangle | Shows how to add a push‑button annotation to a PDF page with Aspose.Pdf, attach a JavaScript acti... |
| add-callout-leader-line-to-freetext-annotation | Add Callout Leader Line to Free-Text Annotation | Document, Page, FreeTextAnnotation | Demonstrates creating a FreeTextAnnotation with a callout leader line by configuring the Callout ... |
| add-diagonal-watermark-annotation | Add Diagonal Watermark Annotation to PDF | Document, Page, Rectangle | Demonstrates how to place a WatermarkAnnotation diagonally across a PDF page using a rectangle ge... |
| add-dynamic-date-watermark-to-pdf-pages | Add Dynamic Date Watermark to PDF Pages | Document, Page, WatermarkAnnotation | Demonstrates how to add a WatermarkAnnotation with a runtime‑generated date string to each page o... |
| add-dynamic-page-number-watermark | Add Dynamic Page Number Watermark to PDF | Document, Page, WatermarkAnnotation | Shows how to create a WatermarkAnnotation that displays the current page number on each page of a... |
| add-external-url-link-annotation | Add External URL Link Annotation to PDF | Document, Page, Rectangle | Shows how to create a link annotation that opens an external website when the user clicks the ann... |
| add-figure-annotation-around-table | Add Figure Annotation Around a Detected Table | Document, TableAbsorber, Rectangle | Demonstrates how to use TableAbsorber to locate a table on a PDF page and draw a square (figure) ... |
| add-figure-annotation-external-image | Add Figure Annotation Referencing External Image | Document, Page, Rectangle | Demonstrates how to create a FileAttachment (figure) annotation in a PDF that uses an external im... |
| add-footer-watermark-to-pdf-pages | Add Footer Watermark to PDF Pages | Document, Page, Rectangle | Demonstrates loading a PDF with Aspose.Pdf, iterating through each page, and adding a WatermarkAn... |
| add-free-text-annotation-arial | Add Free‑Text Annotation with Arial Font to PDF | Document, Page, Rectangle | Demonstrates how to create a free‑text annotation on a PDF page using Arial, 12‑point font, and s... |
| add-free-text-annotation-with-callout | Add Free‑Text Annotation with Callout to PDF | Document, Page, Rectangle | Demonstrates how to load a PDF, create a free‑text annotation with a callout line, set its appear... |
| add-highlight-annotation-70-opacity | Add Highlight Annotation with 70% Opacity to PDF | Document, HighlightAnnotation, Rectangle | Shows how to load a PDF, create a highlight annotation with 70% opacity, set its color, add it to... |
| add-highlight-annotation-with-opacity | Add Highlight Annotation with Custom Opacity to PDF | Document, Page, Rectangle | Shows how to load a PDF, create a highlight annotation with a specific color and opacity, add it ... |
| add-highres-pdf-page-as-tiled-background | Add High-Resolution PDF Page as Tiled Background | Document, Page, BackgroundArtifact | Shows how to use Aspose.Pdf's BackgroundArtifact to set a high‑resolution PDF page as a tiled bac... |
| add-internal-link-annotation-to-pdf | Add Internal Link Annotation to PDF | Document, Page, Rectangle | Shows how to create a link annotation that navigates to a specific page within the same PDF docum... |
| add-javascript-button-annotation-to-pdf-page | Add JavaScript Button Annotation to PDF Page | Document, Page, Rectangle | Demonstrates how to create a push button on page 4 of a PDF and attach a JavaScript action that s... |
| add-javascript-link-annotation-modal-dialog | Add JavaScript Link Annotation to Show Modal Dialog | Document, Page, Rectangle | Shows how to create a link annotation with a JavaScript action that displays a custom modal dialo... |
| add-javascript-link-annotation | Add JavaScript Link Annotation to Open URL | Document, Page, Rectangle | Demonstrates how to add a link annotation with a JavaScript action that opens a URL in a new brow... |
| add-magenta-underline-annotation | Add Magenta Underline Annotation to PDF | Document, Page, Rectangle | Demonstrates how to add an underline annotation with magenta color and a 2‑point border to a PDF ... |
| add-polyline-figure-annotation | Add Polyline Figure Annotation to PDF | Document, Page, Rectangle | Shows how to insert a custom polyline figure annotation onto a PDF page with Aspose.Pdf, defining... |
| add-polyline-figure-annotation__v2 | Add Polyline Figure Annotation to PDF | Document, Page, Rectangle | Shows how to create a polyline figure annotation from a list of points and add it to a PDF page u... |
| add-popup-annotation-to-pdf | Add Popup Annotation Linked to a Sticky Note | Document, Page, TextAnnotation | Demonstrates 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.AnnotationCollectionAspose.Pdf.AnnotationCollection.DeleteAspose.Pdf.Annotations.AnnotationAspose.Pdf.Annotations.AnnotationFlagsAspose.Pdf.Annotations.DefaultAppearanceAspose.Pdf.Annotations.FreeTextAnnotationAspose.Pdf.Annotations.MarkupAnnotationAspose.Pdf.Annotations.ScreenAnnotationAspose.Pdf.Annotations.TextAnnotationAspose.Pdf.Annotations.TextMarkupAnnotationAspose.Pdf.Annotations.TextStyleAspose.Pdf.DocumentAspose.Pdf.Document.SaveAspose.Pdf.Facades.PdfAnnotationEditorAspose.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 -->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
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.

