Getting started
Requirements#
- .NET 10 SDK
- A .NET console, desktop, web, or service project
- Windows, Linux, or macOS for the engine itself
The library is UI-free. Your application chooses its own renderer, interface, storage, and deployment model.
Install from NuGet#
Run this in your project directory:
dotnet add package KillerPdf.EngineOr add the package reference directly:
<PackageReference Include="KillerPdf.Engine" Version="1.8.2" />When working from a KillerPDF repository checkout, use a project reference instead:
<ProjectReference Include="path\to\KillerPDF\engine\KillerPdf.Engine\KillerPdf.Engine.csproj" />Create your first document#
using KillerPdf.Engine.Authoring;
byte[] pdf = new PdfDocumentBuilder()
.SetMetadata(new PdfDocumentMetadata
{
Title = "Hello from The KillerPDF.Engine",
Author = "Example application",
Language = "en-US"
})
.AddBlankPage(612, 792)
.Build();
File.WriteAllBytes("hello.pdf", pdf);Page dimensions use PDF points. A US Letter page is 612 by 792 points.
Open and inspect it#
using KillerPdf.Engine.Documents;
byte[] source = File.ReadAllBytes("hello.pdf");
PdfDocument document = PdfDocument.Open(source);
PdfDocumentInformation information = PdfDocumentInformation.Read(document);
Console.WriteLine(information.Title);
Console.WriteLine($"{information.PageCount} page(s)");
Console.WriteLine($"PDF {information.Version}");Rewrite it deterministically#
using KillerPdf.Engine.Writing;
byte[] rewritten = PdfDocumentWriter.Write(document);
File.WriteAllBytes("hello-rewritten.pdf", rewritten);Use a deterministic rewrite when reproducible output and a normalized object graph matter. Use the incremental editors when preserving the original byte prefix matters.
Choose the next guide#
- Reading PDFs covers metadata, pages, links, bookmarks, and forms.
- Creating PDFs covers pages, content streams, metadata, and modern standards.
- Editing PDFs covers byte-preserving changes to existing files.
- Validation covers structural inspection and independent validators.