NexPDF 0.1.4
dotnet add package NexPDF --version 0.1.4
NuGet\Install-Package NexPDF -Version 0.1.4
<PackageReference Include="NexPDF" Version="0.1.4" />
<PackageVersion Include="NexPDF" Version="0.1.4" />
<PackageReference Include="NexPDF" />
paket add NexPDF --version 0.1.4
#r "nuget: NexPDF, 0.1.4"
#:package NexPDF@0.1.4
#addin nuget:?package=NexPDF&version=0.1.4
#tool nuget:?package=NexPDF&version=0.1.4
NexPDF
Next‑gen, fluent .NET 9 PDF library with a SkiaSharp renderer.
using NexPDF;
using NexPDF.Skia;
using NexPDF.Styling;
Document.Create()
.Page(p => p
.WithSize(PageSize.A4)
.SetMargin(Thickness.Symmetric(60, 72))
.Background(Colors.Grey.Lighten4)
.Header()
.Text("Hello NexPDF!", t => t.WithFontSize(28).Bolden().FontColor(Colors.Blue.Medium))
.AlignCenter()
.Done()
.Content(c => c
.Text("Welcome to NexPDF", t => t.Font(18).Bolden().FontColor(Colors.Indigo.Darken2))
// Column: vertical stacking
.Column(col =>
{
col.Spacing(10);
col.Item().Background(Colors.Blue.Lighten5).Padding(8)
.Text("Column item A", t => t.FontColor(Colors.Blue.Darken2));
col.Item().Height(8); // spacer
col.Item().Background(Colors.Green.Lighten5).Padding(8)
.Text("Column item B", t => t.FontColor(Colors.Green.Darken2));
})
// Row: horizontal layout
.Row(row =>
{
row.Spacing(10);
row.ConstantItem(100).Background(Colors.Grey.Medium).Padding(8).Text("100pt");
row.RelativeItem().Background(Colors.Grey.Lighten1).Padding(8).Text("1x");
row.RelativeItem(2).Background(Colors.Grey.Lighten2).Padding(8).Text("2x");
})
)
.Footer()
.Text(x => x.Span("Page ").CurrentPageNumber())
.AlignCenter()
.Done()
)
.WithMetadata(new DocumentMetadata
{
Title = "Invoice",
Author = "John Doe",
Subject = "Invoice for services",
Keywords = "invoice, services, payment",
Creator = "NexPDF Sample",
Producer = "NexPDF",
Language = "en-US",
CreationDate = DateTimeOffset.Now,
ModifiedDate = DateTimeOffset.Now
})
.GeneratePdf("out.pdf", new SkiaRenderer());
- MIT licensed.
- Cross‑platform: Windows / macOS / Linux.
- SkiaSharp PDF backend with metadata support.
Install
dotnet add package NexPDF
Quick start
using NexPDF;
using NexPDF.Skia;
Document.Create()
.Page(p => p.Content(c => c.Text("Hi from NexPDF")))
.GeneratePdf("out.pdf", new SkiaRenderer());
Core concepts
Document & Page
Document.Create()– start a new document.Page(p => …)– configure one page (size, margins, header/footer, content).GeneratePdf(path, renderer)– output using a renderer (Skia provided)
.Page(p => p
.WithSize(PageSize.A4)
.SetMargin(Thickness.Symmetric(60, 72)) // L/R=60, T/B=72pt
.Background(Colors.Grey.Lighten4)
)
Header / Footer
Inline flow with simple alignment.
.Header()
.Text("Report", t => t.WithFontSize(24).Bolden())
.AlignCenter()
.Done()
.Footer()
.Text(x => x.Span("Page ").CurrentPageNumber())
.AlignCenter()
.Done()
Content builder
Text, Column (vertical), Row (horizontal).
.Content(c => c
.Text("Section title", t => t.Font(18).Bolden())
.Column(col =>
{
col.Spacing(12); // vertical gap between items (default Unit.Points)
col.Item().Background(Colors.Yellow.Lighten4).Padding(8).Text("Item 1");
col.Item().Height(10); // custom spacer
col.Item().Background(Colors.Amber.Lighten4).Padding(8).Text("Item 2");
})
.Row(row =>
{
row.Spacing(10); // horizontal gap
row.ConstantItem(120).Background(Colors.Grey.Medium).Padding(6).Text("120pt");
row.RelativeItem().Background(Colors.Grey.Lighten1).Padding(6).Text("1x");
row.RelativeItem(2).Background(Colors.Grey.Lighten2).Padding(6).Text("2x");
})
)
Units
APIs that take sizes accept an optional unit (default is Unit.Points):
col.Spacing(5, Unit.Millimeters);
row.ConstantItem(5, Unit.Centimeters);
Supported: Points, Millimeters, Centimeters, Inches.
Colors (Material palette)
Use Google Material‑style named colors:
t.FontColor(Colors.Blue.Medium);
p.Background(Colors.Grey.Lighten4);
t.FontColor(Colors.DeepOrange.Accent2);
Palette includes Red, Pink, Purple, DeepPurple, Indigo, Blue, LightBlue, Cyan, Teal, Green, LightGreen, Lime, Yellow, Amber, Orange, DeepOrange, Brown, Grey, BlueGrey, plus Black, White, Transparent.
Metadata
Embed standard PDF document metadata (Title, Author, Subject, Keywords, Creator, Producer, Language, Creation/Modified dates).
.WithMetadata(new DocumentMetadata
{
Title = "Invoice",
Author = "John Doe",
Subject = "Invoice for services",
Keywords = "invoice, services, payment",
Creator = "YourApp",
Producer = "NexPDF",
Language = "en-US",
CreationDate = DateTimeOffset.Now,
ModifiedDate = DateTimeOffset.Now
})
The Skia renderer maps these fields to
SKDocumentPdfMetadata.
Build locally
dotnet build
dotnet test
dotnet run --project samples/HelloNex/HelloNex.csproj
Publish (manual)
dotnet pack src/NexPDF/NexPDF.csproj -c Release -o ./artifacts
dotnet nuget push ./artifacts/*.nupkg --api-key <YOUR_NUGET_API_KEY> --source https://api.nuget.org/v3/index.json --skip-duplicate
Roadmap
- Images & tables
- Fonts, styles, RTL shaping
- Pagination improvements (smart text wrapping, multi‑page rows/columns)
- Page numbering and TOC helpers
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
-
net9.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.