How to Work with the Facades API in .NET
How to Work with the Facades API in .NET
The Facades API provides high-level wrappers for common PDF tasks. This guide covers form filling, file merging, and content editing.
Prerequisites
| Requirement | Detail |
|---|---|
| Runtime | .NET 8.0 or later |
| Package | dotnet add package Aspose.Pdf.Foss |
Fill a form field
The Form facade opens an input PDF, fills fields by name, and writes the result
to a separate output file. This avoids working with the low-level Document object
when all you need is simple field population.
using var form = new Form("input.pdf", "output.pdf");
form.FillField("FirstName", "Alice");
form.Save();Merge two PDFs
PdfFileEditor concatenates multiple PDF files into one output document. Pass the
source file paths and a destination path to produce a single merged result.
var editor = new PdfFileEditor();
editor.Concatenate("file1.pdf", "file2.pdf", "merged.pdf");Extract a page range
The same PdfFileEditor class can extract a contiguous range of pages into a
new file. Specify the start page, end page, and output path.
var editor = new PdfFileEditor();
editor.Extract("source.pdf", 2, 5, "pages2to5.pdf");Key Classes
| Class | Purpose |
|---|---|
Form | Read and write form field values |
PdfFileEditor | Merge, split, extract pages |
PdfContentEditor | Edit page content |
PdfFileSignature | Sign and verify documents |
PdfFileStamp | Add stamps to pages |
PdfConverter | Render pages to images |