Architecture
NetPdf wraps battle-tested, permissively-licensed libraries behind a single coherent surface:
| Capability | Powered by | License |
|---|---|---|
| Create, merge, split, rotate, encrypt | PDFsharp | MIT |
| Text & image extraction | PdfPig | Apache-2.0 |
| Render pages to PNG | PDFtoImage (PDFium) | MIT |
| Barcodes & QR codes | ZXing.Net | Apache-2.0 |
| SVG rasterization | Svg.Skia (SkiaSharp) | MIT |
The three entry points
PdfFile(static) — the front door.Create()returns aPdfBuilderfor coordinate-based drawing;Open(path/stream/bytes, password)returns aPdfDocument;Merge(...)combines files.PdfDocument— the unified document model. Reading (ExtractText,GetImages,Metadata), manipulation (ExtractPages,Split,Overlay,Protect,Sign, …), and rendering (RenderPage). It is immutable: every manipulation returns a newPdfDocument, and it implementsIDisposable.NetPdf.Fluent.Document— the auto-layout engine.Document.Create(doc => ...)measures and paginates content with a two-passMeasure/Drawelement protocol; custom elements implementIElement.
Design notes
- Page indexes are 0-based everywhere; coordinates are PDF points (1/72 inch) from the top-left corner.
- Fonts are resolved from the operating system's font directories on all platforms.
- Operation ordering matters: manipulations →
Linearize()→ XMP /AsPdfA()→Sign()last. See Managing PDFs.