agentic-net-examples / working-with-text
AGENTS.md2 starsChanged 4 months agoMITView on GitHub
C# examples for working-with-text 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-annotationsAGENTS.md
- working-with-attachmentsAGENTS.md
- working-with-formsAGENTS.md
- working-with-graphsAGENTS.md
- working-with-imagesAGENTS.md
- working-with-tablesAGENTS.md
- working-with-xmlAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
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
- Distinctive: line 111
Create a new Document instance ({doc}) and add a blank Page ({page}) using {doc}.Pages.Add().
- Distinctive: line 114
Create a new {doc} (Aspose.Pdf.Document) and add a {page} (Aspose.Pdf.Page) via doc.Pages.Add().
≈ “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-text
Working with text in PDF using C# / .NET -- 73 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-text category. This folder contains standalone C# examples for working-with-text operations. See the root agents.md for repository-wide conventions and boundaries.
Scope
- This folder contains examples for working-with-text.
- Files are standalone
.csexamples stored directly in this folder.
Required Namespaces
using Aspose.Pdf;(73/73 files) ← category-specificusing Aspose.Pdf.Text;(71/73 files) ← category-specificusing Aspose.Pdf.Annotations;(5/73 files)using Aspose.Pdf.Drawing;(3/73 files)using Aspose.Pdf.Forms;(2/73 files)using Aspose.Pdf.Facades;(1/73 files)using System;(73/73 files)using System.IO;(65/73 files)using System.Collections.Generic;(5/73 files)using System.Text.RegularExpressions;(5/73 files)using System.Linq;(1/73 files)using System.Text;(1/73 files)using System.Text.Json;(1/73 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-arabic-bidi-text-to-pdf | Add Arabic Bidirectional Text to PDF | Document, Page, TextFragment | Demonstrates how to open an existing PDF, create a TextFragment with Arabic Unicode characters, c... |
| add-clickable-hyperlink-text-to-pdf | Add Clickable Hyperlink Text to PDF | Document, Page, TextFragment | Shows how to create a TextSegment with a WebHyperlink and append it to a PDF page using Aspose.Pdf. |
| add-endnote-bold-italic | Add Endnote with Bold and Italic Formatting to PDF | Document, TextFragment, Note | Demonstrates how to insert an endnote into a PDF and apply bold and italic formatting using TextS... |
| add-footer-page-numbers-to-pdf | Add Footer Page Numbers to PDF | Document, PageNumberStamp, AddStamp | Shows how to insert a footer with automatic page numbers on every page of an existing PDF using A... |
| add-footnote-with-image-to-pdf | Add Footnote with Image to PDF | Document, Page, TextFragment | Shows how to create a footnote (Note) for a TextFragment, insert an image into the footnote's Par... |
| add-header-to-pdf-pages | Add Header to PDF Pages | Document, Page, TextStamp | Shows how to loop through a PDF's Pages collection and add a repeated header string to each page ... |
| add-invisible-tooltip-button-over-text | Add Invisible Tooltip Button Over Text in PDF | Document, TextFragmentAbsorber, TextFragment | Shows how to locate a specific text fragment in a PDF and overlay an invisible button field that ... |
| add-multi-line-text-paragraph | Add Multi‑Line Text Paragraph to PDF Page | Document, Page, TextParagraph | Demonstrates creating a TextParagraph, setting its rectangle and word‑wrap options, appending mul... |
| add-rotated-text-bottom-right-last-page | Add Rotated Text to Bottom‑Right of Last PDF Page | Document, Page, TextFragment | Demonstrates how to use Aspose.Pdf's TextBuilder to place a rotated text fragment at the bottom‑r... |
| add-rotated-text-watermark-to-pdf-pages | Add Rotated Text Watermark to PDF Pages | Document, Page, TextBuilder | Shows how to use Aspose.Pdf's TextBuilder and TextFragment to place a rotated "CONFIDENTIAL" wate... |
| add-semi-transparent-text-watermark | Add Semi-Transparent Text Watermark to PDF Pages | Document, Page, TextState | Demonstrates how to overlay a semi-transparent watermark text on each page of a PDF using Aspose.... |
| add-styled-html-fragment-to-pdf-page | Add Styled HTML Fragment to PDF Page | Document, HtmlFragment, TextState | Shows how to insert a styled HTML fragment into an existing PDF document using Aspose.Pdf's HtmlF... |
| add-table-to-pdf-footnote | Insert a Table into a PDF Footnote | Document, Page, TextFragment | Demonstrates how to create a footnote for a text fragment and populate it with a table, then add ... |
| add-text-and-encrypt-pdf | Add Text and Encrypt PDF with Password | Document, Page, TextFragment | Loads an existing PDF, adds a red text fragment to the first page, then encrypts the document wit... |
| add-text-to-pdf-from-memory-stream | Add Text to PDF from Memory Stream | Document, Page, TextFragment | Shows how to load a PDF from a Stream, insert a text fragment on the first page, and write the up... |
| add-text-to-pdf-page-at-specific-coordinates | Add Text to PDF Page at Specific Coordinates | Document, Page, TextFragment | Shows how to load a PDF, create a TextFragment, set its position using X/Y coordinates, and save ... |
| add-underlined-text-to-pdf | Add Underlined Text to PDF | Document, Page, TextFragment | Creates a PDF document, adds a page, and inserts a text fragment with underlining by setting Text... |
| adjust-word-spacing-in-pdf | Adjust Word Spacing for Inserted Text in PDF | Document, TextFragment, TextState | Demonstrates how to load an existing PDF, create a TextFragment, set its WordSpacing property, an... |
| append-a-multi-line-textfragment-to-a-page-and-ret... | Append A Multi Line Textfragment To A Page And Retrieve Its ... | TextFragment, TextBuilder | Append A Multi Line Textfragment To A Page And Retrieve Its Line Break Information For Custom Ren... |
| append-disclaimer-to-first-pdf-page | Append Disclaimer Text to First PDF Page | Document, Page, TextFragment | Shows how to load a PDF, create a formatted TextFragment, and add it to the end of the first page... |
| apply-background-color-to-text | Apply Background Color to Text in PDF | Document, Page, TextFragment | Demonstrates how to set a background color for a text fragment in a PDF using Aspose.Pdf by confi... |
| apply-opentype-font-to-textfragment | Apply OpenType Font to TextFragment in PDF | Document, Page, TextFragment | Demonstrates loading an OpenType (OTF) font, embedding it, and applying it to a TextFragment to c... |
| batch-replace-keywords-in-pdf | Batch Replace Keywords in PDF Using a Configuration File | Document, TextFragmentAbsorber, TextFragment | Demonstrates how to read a mapping file and perform batch text replacements in a PDF document usi... |
| batch-replace-multiple-strings-in-pdf | Batch Replace Multiple Strings in PDF | Document, TextFragmentAbsorber, TextReplaceOptions | Shows how to replace several text strings in a PDF by iterating a dictionary of old‑new pairs usi... |
| center-text-horizontally-in-pdf | Center Text Horizontally in PDF | Document, Page, TextFragment | Demonstrates how to place a text fragment at the horizontal center of a PDF page using Aspose.Pdf... |
| convert-modified-pdf-to-byte-array | Convert Modified PDF to Byte Array | Document, Save, Pages | Loads a PDF, adds a blank page, and returns the modified document as a byte array using a MemoryS... |
| create-pdf-launch-action-open-external-file | Create PDF with Launch Action to Open External File | Document, Page, TextFragment | Demonstrates how to add clickable text in a PDF that launches an external file using Aspose.Pdf's... |
| create-rotated-text-paragraph | Create Rotated Text Paragraph in PDF | Document, Page, TextParagraph | Demonstrates how to build a TextParagraph with multiple TextFragments, set its bounding rectangle... |
| create-strikethrough-text-pdf | Create Strikethrough Text in PDF | Document, Page, TextFragment | Shows how to apply strikeout formatting to a TextFragment by setting TextState.StrikeOut and addi... |
| create-text-link-goto-action | Create Text Link with GoTo Action in PDF | Document, Page, TextFragment | Shows how to add a clickable text fragment that jumps to another page by using a LinkAnnotation w... |
| ... | and 43 more files |
Category Statistics
- Total examples: 73
Category-Specific Tips
Key API Surface
Aspose.Pdf.CellAspose.Pdf.Cell.ColSpanAspose.Pdf.Cell.ParagraphsAspose.Pdf.Cell.VerticalAlignmentAspose.Pdf.ColorAspose.Pdf.DocumentAspose.Pdf.Document.SaveAspose.Pdf.Drawing.GradientAxialShadingAspose.Pdf.HtmlFragmentAspose.Pdf.ImageAspose.Pdf.MarginInfoAspose.Pdf.PageAspose.Pdf.PageCollectionAspose.Pdf.RectangleAspose.Pdf.Row
Rules
- Create a new Document instance ({doc}) and add a blank Page ({page}) using {doc}.Pages.Add().
- Instantiate an HtmlFragment ({html_fragment}) with an HTML string ({string_literal}) and insert it into the page via {page}.Paragraphs.Add({html_fragment}).
- Persist the PDF by calling {doc}.Save({output_pdf}).
- Create a new {doc} (Aspose.Pdf.Document) and add a {page} (Aspose.Pdf.Page) via doc.Pages.Add().
- Instantiate an {html_fragment} (Aspose.Pdf.Text.HtmlFragment) with an HTML {string_literal} and add it to the page using page.Paragraphs.Add({html_fragment}).
Warnings
- The example assumes the Aspose.Pdf namespace is imported and the library is referenced.
- HtmlFragment requires well‑formed HTML; malformed markup may cause rendering issues.
- Margin values are in points; setting a large top margin (e.g., 400) may place the content outside the visible page area.
- HtmlFragment supports only a subset of HTML/CSS; complex layouts may not render as expected.
- SubsequentLinesIndent affects only lines that wrap within the same TextFragment; separate TextFragments are treated as separate paragraphs and will not inherit the indent.
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-text 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.

