Writes the PDF format itself — built only on the BCL

Generate PDFs with zero
dependencies. And it's MIT.

A PDF engine for .NET 10 that writes, reads and encrypts ISO 32000 directly on the BCL — embedded Unicode fonts, vector graphics, images and a real layout engine with flow, tables and pagination.

dotnet add package Matios.Pdf
PDF

Invoice

#001
2026-07-08
Matios SpA
DescriptionQtyUnitTotal
Layout engine license1480.00480.00
Unicode font embedding260.00120.00
Vector graphics module1150.00150.00
Support & updates190.0090.00
Total840.00
Generated with Matios.PdfPage 1 of 3
The engine

A PDF engine you can
read end to end.

Matios.Pdf writes the PDF file format itself — header, indirect objects, xref, content streams — on nothing but the BCL. No wrapper over another engine, no third-party package. MIT, and small enough to audit.

0

Zero dependencies

Only System.*System.IO.Compression for FlateDecode. No third-party package, ever.

§

Writes ISO 32000

Emits raw PDF objects and content-stream operators directly against the spec — not a shell over another engine.

Verified in real readers

Output is checked by opening it in pypdf, PIL and FreeType — not just unit-tested in isolation.

Quick start

Draw low, or lay out high

Drop to raw graphics when you need control, or use the flow + table engine when you need pages that paginate themselves.

using Matios.Pdf;

using var doc = new PdfDocument();
var g = doc.Pages.Add(PdfPageSize.A4).Graphics;

g.DrawString("Invoice", PdfFont.HelveticaBold, 24, 72, 80, PdfColor.FromRgb(20, 40, 120));
g.DrawLine(72, 100, 523, 100, PdfColor.Gray, 1.5);
g.DrawRectangle(72, 120, 200, 60, stroke: true, fill: true,
    strokeColor: PdfColor.Blue, fillColor: PdfColor.FromRgb(220, 230, 250));
g.DrawImage(PdfImage.FromFile("logo.png"), 320, 120, 80, 60);

doc.Save("invoice.pdf");
// The font is embedded AND subsetted — the file stays self-contained and small.
var font = PdfFont.FromFile(@"C:\Windows\Fonts\arial.ttf");

g.DrawString("Canción · €50 · ñandú · Ελληνικά · Русский", font, 14, 72, 160);

// Full Unicode via composite Type0 / CIDFontType2, Identity-H, with a ToUnicode map.
using var doc = new PdfDocument();
var flow = new PdfFlow(doc, PdfPageSize.A4, margin: 56);

flow.Header(40, a => a.Graphics.DrawString("Report", PdfFont.HelveticaBold, 13, a.X, a.Y + 14));
flow.Footer(28, a => a.Graphics.DrawString(
    $"Page {a.PageNumber} of {a.TotalPages}", PdfFont.Helvetica, 9, a.X + a.Width, a.Y + 14, PdfTextAlign.Right));

flow.Paragraph("A justified paragraph that wraps and paginates on its own…",
    PdfFont.Helvetica, 12, leading: 16, align: PdfTextAlign.Justify);

flow.Table(t =>
{
    t.ProportionalColumns(6, 1, 2, 2);
    t.Align(PdfTextAlign.Left, PdfTextAlign.Right, PdfTextAlign.Right, PdfTextAlign.Right);
    t.HeaderRow("Description", "Qty", "Unit", "Total");
    t.Row("Matios.Pdf", "1", "480.00", "480.00");   // rows paginate automatically
});

flow.Save("report.pdf");
// Read an existing PDF back into the object model.
using var doc = PdfDocument.Load("in.pdf");
int pages = doc.Pages.Count;

// Encrypt on save — AES-256 (V5/R6). Every string and stream is encrypted.
using var secured = new PdfDocument();
secured.Encrypt("pass");
secured.Pages.Add(PdfPageSize.A4).Graphics
    .DrawString("Confidential", PdfFont.HelveticaBold, 18, 72, 100);
secured.Save("secured.pdf");
using var doc = new PdfDocument();
doc.Info.Title  = "Invoice #001";
doc.Info.Author = "Matios";
// … draw …

doc.Save("invoice.pdf");   // to a file path
doc.Save(stream);            // …or to a Stream (yours to close)
Fonts done right

Embed a full Unicode font — ship only the glyphs you used.

Matios.Pdf embeds a TrueType/OpenType font as a composite Type0 / CIDFontType2 and subsets it to just the characters on the page. A ~1 MB Arial becomes ~17 KB in the file — about 60× smaller, self-contained and correct.

~1 MB~17 KB
Performance

Fast, and it stays out of the way

Writing the format directly means almost no overhead — a page is generated (and parsed back) in microseconds.

~110,000
pages / second
simple page in ~9 µs
~8.6 µs
to parse a page back
reading is as fast as writing
~0.30 ms
embed + subset
a full Unicode font
Scenario Time (ms/op) Alloc (KB/op)
Simple page~0.0087~10.8
Report (multi-page + table)~0.818~941.7
Embedded font + subset~0.297~186.5
Encrypted (AES-256)~2.44~2,789
Parse (Load)~0.0086~23.9

Measured with the project's BenchmarkDotNet suite on .NET 10 Release, one machine. Hardware-dependent — treat as a relative reference, not absolute.

What's implemented

Everything you need to write a document

Text & the 14 standard fontsHelvetica, Times, Courier, Symbol, ZapfDingbats — measured from metrics, with wrap and justify.
Embedded, subsetted Unicode fontsTrueType / OpenType via FromFile — full Unicode, only the glyphs you use.
Vector graphicsLines, rectangles, polygons, circles, ellipses, cubic Béziers, graphics-state save/restore.
ImagesJPEG and PNG (grayscale / truecolor / palette), including transparency via a soft mask.
Layout enginePdfFlow: stacked blocks, auto pagination, repeating header/footer with page numbers.
TablesProportional columns, per-column alignment, repeating header, row stripes, cells that wrap and paginate.
Read & parseLoad an existing PDF back into the object model — as fast as writing one (~8.6 µs).
AES-256 encryptionSave with the standard security handler (AES-256, V5/R6) — every string and stream encrypted on write.
Compression & metadataFlateDecode on by default; title, author, subject, keywords and dates in the Info dictionary.
Pages & outputA3–A5, Letter, Legal, custom, landscape/portrait; save to a file path or a Stream.
Status & roadmap

A full document engine — on NuGet

Writing, reading and encryption are built, green, and published. Merge and digital signatures come next.

v1.0 · now
Write · read · encrypt · fonts · layoutText, vector graphics, images, Unicode embedding + subsetting, flow & tables, PDF parsing (Load) and AES-256 encryption — verified in real PDF readers (pypdf, PIL, FreeType). dotnet add package Matios.Pdf.
Merge & digital signaturesCombining documents and PKCS#7/CMS signing — the next toolkit pieces. Feedback welcome on GitHub.

Add it to your project

Open source · MIT · .NET 10 · zero dependencies

dotnet add package Matios.Pdf