NativePdfGenerator 0.1.0-preview.1

This is a prerelease version of NativePdfGenerator.
dotnet add package NativePdfGenerator --version 0.1.0-preview.1
                    
NuGet\Install-Package NativePdfGenerator -Version 0.1.0-preview.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NativePdfGenerator" Version="0.1.0-preview.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NativePdfGenerator" Version="0.1.0-preview.1" />
                    
Directory.Packages.props
<PackageReference Include="NativePdfGenerator" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NativePdfGenerator --version 0.1.0-preview.1
                    
#r "nuget: NativePdfGenerator, 0.1.0-preview.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package NativePdfGenerator@0.1.0-preview.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NativePdfGenerator&version=0.1.0-preview.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=NativePdfGenerator&version=0.1.0-preview.1&prerelease
                    
Install as a Cake Tool

NativePdfGenerator

A PDF generator written from scratch in pure C#. No external packages — BCL only (System.IO.Compression, System.Xml.Linq, System.Globalization).

This is a writer, not a parser: it builds PDF files directly, from the low-level object model (indirect objects, content streams, cross-reference tables) up to a layout engine with pages, rows, columns, text flow and SVG.

Install

dotnet add package NativePdfGenerator

Usage

using PdfSpec;
using PdfSpec.Elements;
using PdfSpec.Fonts;
using PdfSpec.Geometry;

var doc = PdfDoc.Create()
    .Info(title: "Hello", creator: "NativePdfGenerator")
    .DefaultFont(StandardFont.Helvetica, 11)
    .DefaultPageSize(PageSizes.A4)
    .DefaultMargin(10, Unit.Mm);

doc.AddPage(PageSizes.A4, p =>
{
    p.Body().Paragraph("Hello, PDF.");

    p.Body().Row(r =>
    {
        r.FixedItem(80).Padding(8).Text("Fixed 80pt").Bold();
        r.RelativeItem(2).Padding(8).Text("Grows to twice the remaining width.");
    });
});

doc.Save("hello.pdf");

Repository layout

  • src/PdfSpec/ — the library, published as the NativePdfGenerator package.
  • src/PdfSpec.Samples/ — a console runner that writes sample PDFs into samples/. Run it with dotnet run --project src/PdfSpec.Samples.

Releasing

Pushing a v* tag runs .github/workflows/release.yml, which packs src/PdfSpec at the tag's version and publishes it to nuget.org using trusted publishing (OIDC — no stored API key).

git tag v1.0.0
git push origin v1.0.0

Prerelease tags work the same way (v0.1.0-preview.1); NuGet hides those from default search and dotnet add package unless --prerelease is passed.

License

MIT

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-preview.1 67 8/4/2026