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

agentic-net-examples / working-with-forms

AGENTS.md2 starsChanged 4 months agoMITView on GitHub

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

The file

Files
AGENTS.md

AGENTS - working-with-forms

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

Scope

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

Required Namespaces

  • using Aspose.Pdf; (232/232 files) ← category-specific
  • using Aspose.Pdf.Forms; (187/232 files) ← category-specific
  • using Aspose.Pdf.Annotations; (71/232 files)
  • using Aspose.Pdf.Text; (22/232 files)
  • using Aspose.Pdf.Drawing; (13/232 files)
  • using Aspose.Pdf.Facades; (3/232 files)
  • using Aspose.Pdf.Security; (1/232 files)
  • using Aspose.Pdf.Tagged; (1/232 files)
  • using System; (232/232 files)
  • using System.IO; (210/232 files)
  • using System.Xml; (19/232 files)
  • using System.Collections.Generic; (12/232 files)
  • using System.Drawing; (7/232 files)
  • using System.Linq; (6/232 files)
  • using System.Text; (6/232 files)
  • using System.Xml.Linq; (5/232 files)
  • using System.Text.Json; (3/232 files)
  • using System.Threading.Tasks; (3/232 files)
  • using System.IO.Compression; (2/232 files)
  • using System.Net.Http; (2/232 files)
  • using System.Data; (1/232 files)
  • using System.Globalization; (1/232 files)
  • using System.Security.Cryptography; (1/232 files)
  • using System.Text.Json.Nodes; (1/232 files)
  • using System.Text.RegularExpressions; (1/232 files)
  • using System.Threading; (1/232 files)
  • using System.Xml.Schema; (1/232 files)
  • using System.Xml.Xsl; (1/232 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
acroform-with-marginsCreate AcroForm TextBox Positioned by Page MarginsDocument, Page, MarginInfoShows how to generate a PDF with an AcroForm text box whose position is calculated relative to th...
add-auto-updating-datetime-field-to-pdfAdd Auto‑Updating Date/Time Field to PDFDocument, DateField, RectangleDemonstrates inserting a DateField into a PDF and attaching a JavaScript OpenAction that refreshe...
add-blank-page-save-as-new-pdfAdd Blank Page and Save PDF as New FileDocument, Save, PagesThe example loads an existing PDF, adds a blank page, and saves the modified document to a new fi...
add-blank-page-to-pdf-formAdd Blank Page to PDF FormDocument, Pages, AddShows how to load an existing PDF that contains form fields, append a new blank page, and save th...
add-calculated-total-field-with-javascriptAdd Calculated Total Field with JavaScript in PDF FormDocument, Page, NumberFieldShows how to create numeric input fields and a read‑only total field that automatically sums them...
add-calculated-total-price-field-to-pdf-formAdd Calculated Total Price Field to PDF FormDocument, Form, NumberFieldDemonstrates how to add quantity, unit price, and a read‑only calculated total price field to a P...
add-calculation-button-to-pdf-formAdd Calculation Button to PDF FormDocument, Rectangle, ButtonFieldShows how to create a push‑button in an existing PDF form and attach JavaScript that reads Quanti...
add-checkbox-field-to-pdf-formAdd Checkbox Field to PDF FormDocument, Rectangle, CheckboxFieldShows how to load an existing PDF, create a CheckboxField, add it to the document's form, and sav...
add-current-time-datefield-to-pdfAdd Current Time DateField to PDF on LoadDocument, Page, RectangleDemonstrates how to create a DateField in a PDF using Aspose.Pdf, set its display format to HH:mm...
add-date-field-validationAdd Date Field with Validation to PDFDocument, Rectangle, DateFieldCreates a PDF with a date form field and attaches JavaScript that blocks dates earlier than Janua...
add-date-picker-field-current-dateAdd Date Picker Field with Current Date to PDFDocument, Page, RectangleShows how to insert a date picker form field into a PDF and set its default value to the current ...
add-date-picker-field-to-pdfAdd Date Picker Field to PDFDocument, DateField, BorderShows how to create a DateField on an existing PDF, configure its appearance, initialize it, and ...
add-dynamic-barcode-field-to-pdfAdd Dynamic Barcode Field to PDFDocument, Page, RectangleShows how to load a PDF template, generate a unique value at runtime, create a Code128 barcode fi...
add-dynamic-code128-barcode-to-pdfAdd Dynamic Code128 Barcode Linked to a Text FieldDocument, TextBoxField, BarcodeFieldShows how to insert a Code128 barcode field into a PDF and keep it updated automatically when a s...
add-fallback-metadata-to-pdfAdd Fallback Metadata to PDF from XMLDocument, Metadata, RegisterNamespaceUriShows how to load XML metadata, create missing required fields with default values, and write the...
add-gender-radio-button-group-to-pdfAdd Gender Radio Button Group to PDFDocument, Page, RectangleDemonstrates creating a new PDF document with an AcroForm and adding a gender selection radio but...
add-hidden-ip-field-to-pdfAdd Hidden IP Address Field to PDF with JavaScriptDocument, TextBoxField, RectangleShows how to insert a hidden text box field into a PDF and attach JavaScript that captures the us...
add-hidden-session-id-field-to-pdfAdd Hidden Session ID Field to PDFDocument, Rectangle, TextBoxFieldShows how to insert a hidden text box form field into an existing PDF document to store a session...
add-javascript-email-validation-to-pdf-form-fieldAdd JavaScript Email Validation to PDF Form FieldDocument, Field, JavascriptActionShows how to load a PDF, locate the 'Email' form field, attach a JavaScript OnValidate action tha...
add-javascript-listener-to-pdf-form-fieldAdd JavaScript Listener to PDF Form FieldDocument, Field, JavascriptActionShows how to attach a JavaScript action to a PDF form field using Aspose.Pdf so the script runs w...
add-javascript-localization-to-pdf-formAdd JavaScript Localization to PDF FormDocument, TextBoxField, RectangleDemonstrates embedding a JavaScript dictionary of translations into a PDF and updating a form fie...
add-listbox-to-pdf-formAdd List Box Field to PDF AcroFormDocument, Page, RectangleDemonstrates how to create a PDF document, add an AcroForm list box with country options, and sav...
add-multi-select-list-box-max-3Add Multi-Select List Box with Max 3 Selections to PDFDocument, ListBoxField, RectangleDemonstrates creating a ListBoxField in a PDF, enabling multi‑selection, adding options, and limi...
add-multiline-feedback-text-fieldAdd Multiline Feedback Text Field to PDFDocument, Rectangle, TextBoxFieldDemonstrates how to add a multiline TextBoxField named 'Feedback' with a 500‑character limit to a...
add-new-page-with-acroform-fieldsAdd a New Page with AcroForm Fields to PDFDocument, Page, TextBoxFieldDemonstrates how to append a blank page to an existing PDF and place fresh AcroForm fields (text ...
add-numeric-field-with-validationAdd Numeric Field with Validation to PDFDocument, NumberField, RectangleShows how to insert a numeric form field into a PDF and attach JavaScript validation that restric...
add-password-textbox-field-to-pdfAdd Password TextBox Field to PDFDocument, Form, TextBoxFieldShows how to create a read‑only text box form field in a PDF, set its value as a password, and sa...
add-paymentmethod-radio-button-groupAdd PaymentMethod Radio Button Group to PDFDocument, Page, RadioButtonFieldDemonstrates creating a PDF document with a radio button group named 'PaymentMethod' containing '...
add-progress-bar-field-to-pdf-formAdd Progress Bar Field to PDF FormDocument, Form, TextBoxFieldShows how to insert a TextBoxField that works as a progress bar into a PDF form and update its va...
add-read-only-date-field-to-pdfAdd Read‑Only Date Field to PDFDocument, Page, RectangleDemonstrates creating a date field in a PDF, populating it with the current date/time, and settin...
...and 202 more files

Category Statistics

  • Total examples: 232

Category-Specific Tips

Key API Surface

  • Aspose.Pdf.Document
  • Aspose.Pdf.Document.Save
  • Aspose.Pdf.Facades.Form
  • Aspose.Pdf.Facades.Form.IsRequiredField
  • Aspose.Pdf.Facades.FormEditor
  • Aspose.Pdf.Form
  • Aspose.Pdf.Form.Delete
  • Aspose.Pdf.Forms.ComboBoxField
  • Aspose.Pdf.Forms.ComboBoxField.AddOption
  • Aspose.Pdf.Forms.Field
  • Aspose.Pdf.Forms.Form
  • Aspose.Pdf.Forms.Form.Add
  • Aspose.Pdf.Forms.FormType
  • Aspose.Pdf.Forms.TextBoxField
  • Aspose.Pdf.Page

Rules

  • Bind a PDF document to a FormEditor using BindPdf({input_pdf}) before performing any form modifications.
  • Assign a submit URL to a button field with SetSubmitUrl({field_name}, {url}), where {field_name} is the name of the button and {url} is the target URL.
  • Persist the changes by calling Save({output_pdf}) after all form updates are completed.
  • Load a PDF document: Document {doc} = new Document({input_pdf});
  • Set a tooltip for a form field: (({doc}.Form[{field_name}] as Field).AlternateName = {tooltip_text});

Warnings

  • SetSubmitUrl only works for button fields that are configured as submit buttons; applying it to other field types will have no effect.
  • AlternateName is used as the tooltip; its visibility depends on the PDF viewer.
  • The field must be cast to Aspose.Pdf.Forms.Field to access the AlternateName property.
  • Arabic text may require a font that supports Arabic glyphs; the example does not explicitly set a font, which could affect rendering in some viewers.
  • Page indexing in Aspose.Pdf is 1‑based; ensure the page exists before referencing it.

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-forms 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.