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

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

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:

    Create a new Document instance ({doc}) and add a blank Page ({page}) using {doc}.Pages.Add().

    line 111
  2. Distinctive:

    Create a new {doc} (Aspose.Pdf.Document) and add a {page} (Aspose.Pdf.Page) via doc.Pages.Add().

    line 114

≈ “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-text

Working with text in PDF using C# / .NET -- 73 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-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 .cs examples stored directly in this folder.

Required Namespaces

  • using Aspose.Pdf; (73/73 files) ← category-specific
  • using Aspose.Pdf.Text; (71/73 files) ← category-specific
  • using 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

FileTitleKey APIsDescription
add-arabic-bidi-text-to-pdfAdd Arabic Bidirectional Text to PDFDocument, Page, TextFragmentDemonstrates how to open an existing PDF, create a TextFragment with Arabic Unicode characters, c...
add-clickable-hyperlink-text-to-pdfAdd Clickable Hyperlink Text to PDFDocument, Page, TextFragmentShows how to create a TextSegment with a WebHyperlink and append it to a PDF page using Aspose.Pdf.
add-endnote-bold-italicAdd Endnote with Bold and Italic Formatting to PDFDocument, TextFragment, NoteDemonstrates how to insert an endnote into a PDF and apply bold and italic formatting using TextS...
add-footer-page-numbers-to-pdfAdd Footer Page Numbers to PDFDocument, PageNumberStamp, AddStampShows how to insert a footer with automatic page numbers on every page of an existing PDF using A...
add-footnote-with-image-to-pdfAdd Footnote with Image to PDFDocument, Page, TextFragmentShows how to create a footnote (Note) for a TextFragment, insert an image into the footnote's Par...
add-header-to-pdf-pagesAdd Header to PDF PagesDocument, Page, TextStampShows how to loop through a PDF's Pages collection and add a repeated header string to each page ...
add-invisible-tooltip-button-over-textAdd Invisible Tooltip Button Over Text in PDFDocument, TextFragmentAbsorber, TextFragmentShows how to locate a specific text fragment in a PDF and overlay an invisible button field that ...
add-multi-line-text-paragraphAdd Multi‑Line Text Paragraph to PDF PageDocument, Page, TextParagraphDemonstrates creating a TextParagraph, setting its rectangle and word‑wrap options, appending mul...
add-rotated-text-bottom-right-last-pageAdd Rotated Text to Bottom‑Right of Last PDF PageDocument, Page, TextFragmentDemonstrates how to use Aspose.Pdf's TextBuilder to place a rotated text fragment at the bottom‑r...
add-rotated-text-watermark-to-pdf-pagesAdd Rotated Text Watermark to PDF PagesDocument, Page, TextBuilderShows how to use Aspose.Pdf's TextBuilder and TextFragment to place a rotated "CONFIDENTIAL" wate...
add-semi-transparent-text-watermarkAdd Semi-Transparent Text Watermark to PDF PagesDocument, Page, TextStateDemonstrates how to overlay a semi-transparent watermark text on each page of a PDF using Aspose....
add-styled-html-fragment-to-pdf-pageAdd Styled HTML Fragment to PDF PageDocument, HtmlFragment, TextStateShows how to insert a styled HTML fragment into an existing PDF document using Aspose.Pdf's HtmlF...
add-table-to-pdf-footnoteInsert a Table into a PDF FootnoteDocument, Page, TextFragmentDemonstrates how to create a footnote for a text fragment and populate it with a table, then add ...
add-text-and-encrypt-pdfAdd Text and Encrypt PDF with PasswordDocument, Page, TextFragmentLoads an existing PDF, adds a red text fragment to the first page, then encrypts the document wit...
add-text-to-pdf-from-memory-streamAdd Text to PDF from Memory StreamDocument, Page, TextFragmentShows 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-coordinatesAdd Text to PDF Page at Specific CoordinatesDocument, Page, TextFragmentShows how to load a PDF, create a TextFragment, set its position using X/Y coordinates, and save ...
add-underlined-text-to-pdfAdd Underlined Text to PDFDocument, Page, TextFragmentCreates a PDF document, adds a page, and inserts a text fragment with underlining by setting Text...
adjust-word-spacing-in-pdfAdjust Word Spacing for Inserted Text in PDFDocument, TextFragment, TextStateDemonstrates 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, TextBuilderAppend A Multi Line Textfragment To A Page And Retrieve Its Line Break Information For Custom Ren...
append-disclaimer-to-first-pdf-pageAppend Disclaimer Text to First PDF PageDocument, Page, TextFragmentShows how to load a PDF, create a formatted TextFragment, and add it to the end of the first page...
apply-background-color-to-textApply Background Color to Text in PDFDocument, Page, TextFragmentDemonstrates how to set a background color for a text fragment in a PDF using Aspose.Pdf by confi...
apply-opentype-font-to-textfragmentApply OpenType Font to TextFragment in PDFDocument, Page, TextFragmentDemonstrates loading an OpenType (OTF) font, embedding it, and applying it to a TextFragment to c...
batch-replace-keywords-in-pdfBatch Replace Keywords in PDF Using a Configuration FileDocument, TextFragmentAbsorber, TextFragmentDemonstrates how to read a mapping file and perform batch text replacements in a PDF document usi...
batch-replace-multiple-strings-in-pdfBatch Replace Multiple Strings in PDFDocument, TextFragmentAbsorber, TextReplaceOptionsShows how to replace several text strings in a PDF by iterating a dictionary of old‑new pairs usi...
center-text-horizontally-in-pdfCenter Text Horizontally in PDFDocument, Page, TextFragmentDemonstrates how to place a text fragment at the horizontal center of a PDF page using Aspose.Pdf...
convert-modified-pdf-to-byte-arrayConvert Modified PDF to Byte ArrayDocument, Save, PagesLoads a PDF, adds a blank page, and returns the modified document as a byte array using a MemoryS...
create-pdf-launch-action-open-external-fileCreate PDF with Launch Action to Open External FileDocument, Page, TextFragmentDemonstrates how to add clickable text in a PDF that launches an external file using Aspose.Pdf's...
create-rotated-text-paragraphCreate Rotated Text Paragraph in PDFDocument, Page, TextParagraphDemonstrates how to build a TextParagraph with multiple TextFragments, set its bounding rectangle...
create-strikethrough-text-pdfCreate Strikethrough Text in PDFDocument, Page, TextFragmentShows how to apply strikeout formatting to a TextFragment by setting TextState.StrikeOut and addi...
create-text-link-goto-actionCreate Text Link with GoTo Action in PDFDocument, Page, TextFragmentShows 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.Cell
  • Aspose.Pdf.Cell.ColSpan
  • Aspose.Pdf.Cell.Paragraphs
  • Aspose.Pdf.Cell.VerticalAlignment
  • Aspose.Pdf.Color
  • Aspose.Pdf.Document
  • Aspose.Pdf.Document.Save
  • Aspose.Pdf.Drawing.GradientAxialShading
  • Aspose.Pdf.HtmlFragment
  • Aspose.Pdf.Image
  • Aspose.Pdf.MarginInfo
  • Aspose.Pdf.Page
  • Aspose.Pdf.PageCollection
  • Aspose.Pdf.Rectangle
  • Aspose.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 -->

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.