How to Work with the Facades API in .NET

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

RequirementDetail
Runtime.NET 8.0 or later
Packagedotnet 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

ClassPurpose
FormRead and write form field values
PdfFileEditorMerge, split, extract pages
PdfContentEditorEdit page content
PdfFileSignatureSign and verify documents
PdfFileStampAdd stamps to pages
PdfConverterRender pages to images

See Also