|
| 1 | +--- |
| 2 | +name: facades-fill-forms |
| 3 | +description: C# examples for facades-fill-forms using Aspose.PDF for .NET |
| 4 | +language: csharp |
| 5 | +framework: net10.0 |
| 6 | +parent: ../agents.md |
| 7 | +--- |
| 8 | + |
| 9 | +# AGENTS - facades-fill-forms |
| 10 | + |
| 11 | +## Persona |
| 12 | + |
| 13 | +You are a C# developer specializing in PDF processing using Aspose.PDF for .NET, |
| 14 | +working within the **facades-fill-forms** category. |
| 15 | +This folder contains standalone C# examples for facades-fill-forms operations. |
| 16 | +See the root [agents.md](../agents.md) for repository-wide conventions and boundaries. |
| 17 | + |
| 18 | +## Scope |
| 19 | +- This folder contains examples for **facades-fill-forms**. |
| 20 | +- Files are standalone `.cs` examples stored directly in this folder. |
| 21 | + |
| 22 | +## Required Namespaces |
| 23 | + |
| 24 | +- `using Aspose.Pdf.Facades;` (27/28 files) ← category-specific |
| 25 | +- `using Aspose.Pdf;` (13/28 files) |
| 26 | +- `using Aspose.Pdf.Forms;` (3/28 files) |
| 27 | +- `using System;` (28/28 files) |
| 28 | +- `using System.IO;` (28/28 files) |
| 29 | +- `using System.Data;` (19/28 files) ← category-specific |
| 30 | +- `using System.Collections.Generic;` (5/28 files) |
| 31 | +- `using System.Threading;` (2/28 files) |
| 32 | +- `using System.Threading.Tasks;` (2/28 files) |
| 33 | +- `using System.Linq;` (1/28 files) |
| 34 | +- `using System.Text.Json;` (1/28 files) |
| 35 | + |
| 36 | +## Common Code Pattern |
| 37 | + |
| 38 | +Most files follow this pattern: |
| 39 | + |
| 40 | +```csharp |
| 41 | +using (Document doc = new Document("input.pdf")) |
| 42 | +{ |
| 43 | + // ... operations ... |
| 44 | + doc.Save("output.pdf"); |
| 45 | +} |
| 46 | +``` |
| 47 | + |
| 48 | +## Files in this folder |
| 49 | + |
| 50 | +| File | Title | Key APIs | Description | |
| 51 | +|------|-------|----------|-------------| |
| 52 | +| [add-current-date-header-to-pdf](./add-current-date-header-to-pdf.cs) | Add Current Date Header to PDF Using AutoFiller | `BindPdf`, `Save`, `BindPdf` | Shows how to generate a PDF from a template with AutoFiller and then add a header containing the ... | |
| 53 | +| [async-fill-pdf-form-from-xlsx](./async-fill-pdf-form-from-xlsx.cs) | Asynchronously Fill PDF Form from XLSX Data | `Document`, `Form`, `FillField` | The example reads an XLSX file asynchronously, extracts field values, fills a PDF form using Aspo... | |
| 54 | +| [batch-fill-pdf-template-with-multiple-datatables](./batch-fill-pdf-template-with-multiple-datatables.cs) | Batch Fill PDF Template with Multiple DataTables | `AutoFiller`, `BindPdf`, `ImportDataTable` | Shows how to repeatedly fill a single PDF form template using a list of DataTable objects, produc... | |
| 55 | +| [bind-pdf-form-to-autofiller](./bind-pdf-form-to-autofiller.cs) | Bind PDF Form to AutoFiller and Save | `AutoFiller`, `BindPdf`, `Save` | Demonstrates how to bind an existing PDF form to an Aspose.Pdf.Facades.AutoFiller instance and sa... | |
| 56 | +| [configure-datacolumn-properties-fill-pdf-form](./configure-datacolumn-properties-fill-pdf-form.cs) | Configure DataColumn Properties and Fill PDF Form with AutoF... | `Document`, `Page`, `Rectangle` | The example shows how to set DataColumn flags such as ReadOnly and Unique before importing a Data... | |
| 57 | +| [convert-filled-pdf-to-byte-array](./convert-filled-pdf-to-byte-array.cs) | Convert Filled PDF to Byte Array Using PdfViewer | `PdfViewer`, `BindPdf`, `Save` | Shows how to load a filled PDF with Aspose.Pdf.Facades.PdfViewer and return its content as a byte... | |
| 58 | +| [extract-pdf-pages-with-custom-names](./extract-pdf-pages-with-custom-names.cs) | Extract PDF Pages with Custom File Names from DataTable | `PdfFileEditor`, `Extract` | Shows how to split a PDF into individual pages using Aspose.Pdf.Facades.PdfFileEditor and name ea... | |
| 59 | +| [fill-pdf-form-async-timeout](./fill-pdf-form-async-timeout.cs) | Fill PDF Form Asynchronously with Timeout Cancellation | `Form`, `BindPdf`, `FillField` | Demonstrates how to fill a PDF form using Aspose.Pdf.Facades, then save the document asynchronous... | |
| 60 | +| [fill-pdf-form-from-csv](./fill-pdf-form-from-csv.cs) | Fill PDF Form from CSV Data | `Form`, `FillField`, `Save` | Shows how to read a CSV file into a DataTable, map column names to PDF form field names, and use ... | |
| 61 | +| [fill-pdf-form-per-datarow-merge-pages](./fill-pdf-form-per-datarow-merge-pages.cs) | Fill PDF Form per DataTable Row and Merge Pages with Logging | `Document`, `AutoFiller`, `BindPdf` | Demonstrates how to fill a PDF form for each DataTable row using AutoFiller, merge the generated ... | |
| 62 | +| [fill-pdf-form-using-autofiller-datatable](./fill-pdf-form-using-autofiller-datatable.cs) | Fill PDF Form Using AutoFiller and DataTable | `AutoFiller`, `BindPdf`, `ImportDataTable` | Demonstrates how to bind a PDF template, import a DataTable whose column names match AcroForm fie... | |
| 63 | +| [fill-pdf-form-validate-size](./fill-pdf-form-validate-size.cs) | Fill PDF Form and Validate Generated File Size | `AutoFiller`, `BindPdf`, `ImportDataTable` | Demonstrates using Aspose.Pdf.Facades.AutoFiller to merge a DataTable into a PDF form, save the r... | |
| 64 | +| [fill-pdf-form-with-autofiller](./fill-pdf-form-with-autofiller.cs) | Fill PDF Form Using AutoFiller and DataTable | `AutoFiller`, `BindPdf`, `ImportDataTable` | Shows how to bind a PDF template, import data from a DataTable (simulating an XLSX source), and g... | |
| 65 | +| [fill-pdf-form-with-autofiller__v2](./fill-pdf-form-with-autofiller__v2.cs) | Fill PDF Form Using AutoFiller and Dispose Resources | `AutoFiller`, `InputFileName`, `ImportDataTable` | Demonstrates how to populate a PDF form from a DataTable using Aspose.Pdf.Facades.AutoFiller and ... | |
| 66 | +| [fill-pdf-form-with-csv-dynamic-mapping](./fill-pdf-form-with-csv-dynamic-mapping.cs) | Fill PDF Form Using CSV Data with Dynamic Column Mapping | `AutoFiller`, `BindPdf`, `ImportDataTable` | Demonstrates loading CSV data into a DataTable, applying a JSON‑based column‑to‑PDF‑field mapping... | |
| 67 | +| [fill-pdf-form-with-data-table-exception-handling](./fill-pdf-form-with-data-table-exception-handling.cs) | Fill PDF Form with DataTable and Handle Exceptions | `AutoFiller`, `BindPdf`, `ImportDataTable` | The example shows how to use Aspose.Pdf.Facades.AutoFiller to bind a PDF template, import data fr... | |
| 68 | +| [fill-pdf-form-with-datatable-custom-columns](./fill-pdf-form-with-datatable-custom-columns.cs) | Fill PDF Form Using DataTable with Custom Columns | `Document`, `Page`, `TextBoxField` | Shows how to create a PDF form, add matching DataTable columns (including extra custom columns) v... | |
| 69 | +| [generate-pdf-page-summary-report](./generate-pdf-page-summary-report.cs) | Generate PDF Page‑to‑DataTable Summary Report | `Document`, `Save`, `Add` | Creates a PDF (or a blank one if missing), populates a DataTable with identifiers for each page, ... | |
| 70 | +| [generate-pdf-per-datarow](./generate-pdf-per-datarow.cs) | Generate One‑Page PDFs from DataTable Rows | `Document`, `Page`, `Rectangle` | Demonstrates loading a PDF form template, filling its fields with values from each DataTable row,... | |
| 71 | +| [generate-pdfs-from-multiple-csv-worksheets](./generate-pdfs-from-multiple-csv-worksheets.cs) | Generate PDFs from Multiple CSV Worksheets using AutoFiller | `AutoFiller`, `BindPdf`, `ImportDataTable` | The example reads each CSV file in a folder, converts it to a DataTable, and uses Aspose.Pdf.Faca... | |
| 72 | +| [map-datatable-columns-to-pdf-form-fields](./map-datatable-columns-to-pdf-form-fields.cs) | Map DataTable Columns to PDF Form Fields with AutoFiller | `AutoFiller`, `BindPdf`, `ImportDataTable` | Shows how to rename DataTable columns to match PDF form field identifiers and use Aspose.Pdf.Faca... | |
| 73 | +| [merge-filled-pdfs-from-datatables](./merge-filled-pdfs-from-datatables.cs) | Merge Multiple Filled PDFs Generated from DataTables | `BindPdf`, `ImportDataTable`, `Save` | The example fills a PDF form template with data from several DataTables, saves each filled docume... | |
| 74 | +| [password-protect-filled-pdf](./password-protect-filled-pdf.cs) | Password‑Protect a Filled PDF with Aspose.Pdf | `Document`, `Save`, `PdfFileSecurity` | Demonstrates loading an already filled PDF and applying user and owner passwords with specific pr... | |
| 75 | +| [process-pdf-with-temp-folder](./process-pdf-with-temp-folder.cs) | Process PDF with Temporary Folder and Disk Buffer | `Document`, `PdfSaveOptions`, `PdfFileEditor` | Demonstrates how to use a unique temporary folder and disk buffering while processing large PDFs ... | |
| 76 | +| [save-filled-pdf-preserve-layout](./save-filled-pdf-preserve-layout.cs) | Save Filled PDF While Preserving Layout | `Form`, `BindPdf`, `Save` | Shows how to bind a filled PDF using the Form facade and save it to a new file, keeping the origi... | |
| 77 | +| [split-filled-pdf-into-single-page-pdfs](./split-filled-pdf-into-single-page-pdfs.cs) | Split Filled PDF into Single-Page PDFs | `PdfFileEditor`, `SplitToPages` | Demonstrates loading a filled PDF and using Aspose.Pdf.Facades.PdfFileEditor to split it into ind... | |
| 78 | +| [stream-large-csv-fill-pdf-form](./stream-large-csv-fill-pdf-form.cs) | Stream Large CSV Data into PDF Form Using AutoFiller | `AutoFiller`, `BindPdf`, `ImportDataTable` | Demonstrates how to read a large CSV file row‑by‑row into a DataTable and use Aspose.Pdf.Facades.... | |
| 79 | +| [validate-required-pdf-form-fields](./validate-required-pdf-form-fields.cs) | Validate Required PDF Form Fields Against DataTable Columns | `Form`, `FieldNames`, `IsRequiredField` | Shows how to check that every required AcroForm field in a PDF has a matching column in a DataTab... | |
| 80 | + |
| 81 | +## Category Statistics |
| 82 | +- Total examples: 28 |
| 83 | + |
| 84 | +## Category-Specific Tips |
| 85 | + |
| 86 | +### Key API Surface |
| 87 | +- `Aspose.Pdf.Facades.FieldType` |
| 88 | +- `Aspose.Pdf.Facades.Form` |
| 89 | +- `Aspose.Pdf.Facades.Form.BindPdf` |
| 90 | +- `Aspose.Pdf.Facades.Form.BindPdf(string)` |
| 91 | +- `Aspose.Pdf.Facades.Form.ExportFdf` |
| 92 | +- `Aspose.Pdf.Facades.Form.FillField(string, string)` |
| 93 | +- `Aspose.Pdf.Facades.Form.GetField(string)` |
| 94 | +- `Aspose.Pdf.Facades.Form.ImportFdf` |
| 95 | +- `Aspose.Pdf.Facades.Form.Save` |
| 96 | +- `Aspose.Pdf.Facades.Form.Save(string)` |
| 97 | +- `Aspose.Pdf.Facades.FormEditor` |
| 98 | +- `Aspose.Pdf.Facades.FormEditor.BindPdf` |
| 99 | +- `Aspose.Pdf.Facades.FormEditor.CopyOuterField` |
| 100 | +- `Aspose.Pdf.Facades.FormEditor.Save` |
| 101 | +- `Aspose.Pdf.Facades.FormFieldFacade` |
| 102 | + |
| 103 | +### Rules |
| 104 | +- Bind a PDF file to a Form facade with Form.BindPdf({input_pdf}). |
| 105 | +- Flatten every form field in the bound document by calling Form.FlattenAllFields(). |
| 106 | +- Persist the flattened document using Form.Save({output_pdf}). |
| 107 | +- Use Form.BindPdf({input_pdf}) to open a PDF document for form manipulation. |
| 108 | +- Open an FDF file as a stream and call Form.ImportFdf({fdf_stream}) to populate the PDF form fields. |
| 109 | + |
| 110 | +### Warnings |
| 111 | +- The Form class belongs to the Aspose.Pdf.Facades namespace, which may be deprecated in future releases; consider using the newer Document/FormField APIs. |
| 112 | +- The example manually manages the FileStream; ensure the stream is closed or disposed to avoid resource leaks. |
| 113 | +- The example assumes the target PDF already contains an AcroForm; otherwise AddField may have no effect. |
| 114 | +- Coordinate values are in points; callers must convert from other units if needed. |
| 115 | +- FormFieldFacade.Alignment expects one of the FormFieldFacade alignment constants (e.g., AlignCenter). |
| 116 | + |
| 117 | +## General Tips |
| 118 | +- See parent [agents.md](../agents.md) for: |
| 119 | + - **Boundaries** — Always / Ask First / Never rules for all examples |
| 120 | + - **Common Mistakes** — verified anti-patterns that cause build failures |
| 121 | + - **Domain Knowledge** — cross-cutting API-specific gotchas |
| 122 | + - **Testing Guide** — build and run verification steps |
| 123 | +- Review code examples in this folder for facades-fill-forms patterns |
| 124 | + |
| 125 | +<!-- AUTOGENERATED:START --> |
| 126 | +Updated: 2026-05-08 | Run: `20260508_144436_050a95` |
| 127 | +<!-- AUTOGENERATED:END --> |
0 commit comments