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.
| Description | Qty | Unit | Total |
|---|---|---|---|
| Layout engine license | 1 | 480.00 | 480.00 |
| Unicode font embedding | 2 | 60.00 | 120.00 |
| Vector graphics module | 1 | 150.00 | 150.00 |
| Support & updates | 1 | 90.00 | 90.00 |
| Total | 840.00 |
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.
Only System.* — System.IO.Compression for FlateDecode. No third-party package, ever.
Emits raw PDF objects and content-stream operators directly against the spec — not a shell over another engine.
Output is checked by opening it in pypdf, PIL and FreeType — not just unit-tested in isolation.
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)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.
Writing the format directly means almost no overhead — a page is generated (and parsed back) in microseconds.
| 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.
FromFile — full Unicode, only the glyphs you use.PdfFlow: stacked blocks, auto pagination, repeating header/footer with page numbers.Stream.Writing, reading and encryption are built, green, and published. Merge and digital signatures come next.
Load) and AES-256 encryption — verified in real PDF readers (pypdf, PIL, FreeType). dotnet add package Matios.Pdf.Open source · MIT · .NET 10 · zero dependencies
dotnet add package Matios.Pdf