Lxman.PdfLibrary
0.0.10-beta
Superseded by the stable 1.0.0 release. Please upgrade to 1.0.0.
See the version list below for details.
dotnet add package Lxman.PdfLibrary --version 0.0.10-beta
NuGet\Install-Package Lxman.PdfLibrary -Version 0.0.10-beta
<PackageReference Include="Lxman.PdfLibrary" Version="0.0.10-beta" />
<PackageVersion Include="Lxman.PdfLibrary" Version="0.0.10-beta" />
<PackageReference Include="Lxman.PdfLibrary" />
paket add Lxman.PdfLibrary --version 0.0.10-beta
#r "nuget: Lxman.PdfLibrary, 0.0.10-beta"
#:package Lxman.PdfLibrary@0.0.10-beta
#addin nuget:?package=Lxman.PdfLibrary&version=0.0.10-beta&prerelease
#tool nuget:?package=Lxman.PdfLibrary&version=0.0.10-beta&prerelease
PdfLibrary
A comprehensive .NET library for parsing, rendering, and creating PDF documents. Built with C# and targeting .NET 10.
Features
PDF Rendering
- Full PDF 1.x and 2.0 parsing support
- High-quality rendering using SkiaSharp
- Support for complex graphics operations (paths, clipping, transparency)
- Comprehensive color space support (DeviceRGB, DeviceCMYK, DeviceGray, ICCBased, Separation, Lab)
- Image handling (JPEG, PNG, CCITT, JBIG2, JPEG2000)
- Font rendering (Type1, TrueType, CID, embedded fonts)
- Text extraction and positioning
PDF Creation (Fluent Builder API)
- Intuitive fluent API for document creation
- Text with full styling (fonts, colors, spacing)
- Vector graphics (rectangles, circles, lines, paths)
- Image embedding (JPEG, PNG)
- Interactive forms (text fields, checkboxes, radio buttons, dropdowns)
- Annotations (links, notes, highlights)
- Bookmarks/Outlines with hierarchical navigation
- Page labels (custom numbering schemes)
- Layers (Optional Content Groups)
- Encryption (RC4, AES-128, AES-256)
- Custom font embedding (TrueType, OpenType)
Project Structure
PDF/
├── PdfLibrary/ # Core library
│ ├── Document/ # PDF document model
│ ├── Content/ # Content stream processing
│ ├── Rendering/ # Rendering pipeline
│ ├── Builder/ # Fluent API for PDF creation
│ ├── Fonts/ # Font handling
│ ├── Images/ # Image decompression
│ ├── ColorSpaces/ # Color space support
│ ├── Parsing/ # PDF parsing (lexer, parser)
│ └── Security/ # Encryption/decryption
├── PdfLibrary.Rendering.SkiaSharp/ # SkiaSharp render target
├── PdfLibrary.Tests/ # Unit tests
├── PdfLibrary.Integration/ # Integration tests
├── PdfLibrary.Wpf.Viewer/ # WPF PDF viewer application
├── Compressors/ # Image decompression libraries
│ ├── Compressors.Lzw/ # LZW decompression
│ │ └── Compressors.Lzw.Tests/
│ ├── Compressors.Ccitt/ # CCITT fax (Group 3/4)
│ │ └── Compressors.Ccitt.Tests/
│ ├── Compressors.Jbig2/ # JBIG2 decompression
│ │ └── Compressors.Jbig2.Tests/
│ ├── Compressors.Jpeg/ # JPEG (DCT) decompression
│ │ └── Compressors.Jpeg.Tests/
│ └── Compressors.Jpeg2000/ # JPEG2000 (legacy)
│ └── Compressors.Jpeg2000.Tests/
├── FontParser/ # TrueType/OpenType parsing
├── Logging/ # Logging infrastructure
└── Docs/ # Documentation
Quick Start
Rendering a PDF
using PdfLibrary.Structure;
using PdfLibrary.Rendering.SkiaSharp;
// Load a PDF document
using var stream = File.OpenRead("document.pdf");
var document = PdfDocument.Load(stream);
// Get the page to render
var page = document.GetPage(0); // 0-based index
// Render to file using the fluent API
page.Render(document)
.WithScale(1.0) // 1.0 = 72 DPI
.ToFile("output.png");
// Or render to SKImage for further processing
using var image = page.Render(document)
.WithDpi(144) // 2x resolution
.ToImage();
Creating a PDF
using PdfLibrary.Builder;
PdfDocumentBuilder.Create()
.WithMetadata(meta => meta
.Title("My Document")
.Author("John Doe"))
.AddPage(page => page
.AddText("Hello, World!", 100, 700)
.WithFont("Helvetica-Bold")
.WithSize(24)
.WithColor(PdfColor.Blue)
.AddRectangle(100, 650, 200, 30)
.Fill(PdfColor.LightGray)
.Stroke(PdfColor.Black))
.AddPage(page => page
.AddText("Page 2", 100, 700))
.AddBookmark("Page 1", 0)
.AddBookmark("Page 2", 1)
.Save("output.pdf");
Creating a Form
PdfDocumentBuilder.Create()
.AddPage(page => page
.AddText("Registration Form", 100, 750)
.WithSize(18)
.Bold()
.AddText("Name:", 100, 700)
.AddTextField("name", 170, 695, 200, 25)
.Required()
.AddText("Email:", 100, 660)
.AddTextField("email", 170, 655, 200, 25)
.AddText("I agree to terms:", 100, 620)
.AddCheckbox("agree", 220, 618, 18, 18))
.WithAcroForm(form => form.SetNeedAppearances(true))
.Save("form.pdf");
Requirements
- .NET 10.0 or later
- SkiaSharp (for rendering)
- SixLabors.ImageSharp (for image processing)
Building
# Clone the repository
git clone https://github.com/yourusername/PDF.git
cd PDF
# Build the solution
dotnet build PdfProcessor.slnx
# Run tests
dotnet test PdfLibrary.Tests/PdfLibrary.Tests.csproj
Documentation
- Fluent API Reference - Complete guide to the PDF creation API
- Getting Started - Step-by-step introduction
- Architecture - Technical architecture overview
Supported PDF Features
Content Streams
- Graphics state operators (q, Q, cm, w, J, j, M, d, ri, i, gs)
- Path operators (m, l, c, v, y, h, re, S, s, f, F, f*, B, B*, b, b*, n, W, W*)
- Text operators (BT, ET, Tc, Tw, Tz, TL, Tf, Tr, Ts, Td, TD, Tm, T*, Tj, TJ, ', ")
- Color operators (CS, cs, SC, SCN, sc, scn, G, g, RG, rg, K, k)
- XObject operators (Do)
- Inline image operators (BI, ID, EI)
- Marked content operators (MP, DP, BMC, BDC, EMC)
Color Spaces
- DeviceGray, DeviceRGB, DeviceCMYK
- CalGray, CalRGB, Lab
- ICCBased
- Indexed
- Separation, DeviceN
- Pattern (tiling and shading)
Fonts
- Type1, Type1C (CFF)
- TrueType
- Type0 (CID fonts)
- Type3
- Embedded and system fonts
Images
- DCTDecode (JPEG)
- FlateDecode (PNG/zlib)
- LZWDecode
- CCITTFaxDecode (Group 3 and 4)
- JBIG2Decode
- JPXDecode (JPEG2000)
- RunLengthDecode
- ASCII85Decode, ASCIIHexDecode
Security
- RC4 40-bit and 128-bit encryption
- AES 128-bit and 256-bit encryption
- Permission flags
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
Development Setup
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Code Style
- Follow C# coding conventions
- Use meaningful variable and method names
- Add XML documentation for public APIs
- Include unit tests for new features
Acknowledgments
- SkiaSharp - 2D graphics library
- ImageSharp - Image processing library
- Serilog - Logging framework
| Product | Versions 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. |
-
net10.0
- Compressors.Ccitt (>= 1.0.0)
- Compressors.Jbig2 (>= 1.0.0)
- Compressors.Jpeg (>= 1.0.0)
- Compressors.Jpeg2000 (>= 1.0.0)
- Compressors.Lzw (>= 1.0.0)
- FontParser (>= 1.0.0)
- Logging (>= 1.0.0)
- Serilog (>= 4.3.1-dev-02395)
- Serilog.Sinks.File (>= 7.0.1-dev-02315)
- Wacton.Unicolour (>= 6.3.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Lxman.PdfLibrary:
| Package | Downloads |
|---|---|
|
Lxman.PdfLibrary.Rendering.Wpf
WPF rendering backend for PdfLibrary. Renders PDF pages to retained WPF DrawingGroup vector visuals for crisp, zoomable display, and provides the geometry to overlay native controls on form fields. Windows-only (WPF). Pairs with the Lxman.PdfLibrary core package on .NET 8, 9, and 10. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 2.5.2 | 93 | 7/30/2026 | |
| 2.5.1 | 100 | 7/24/2026 | |
| 2.5.0 | 6,248 | 7/20/2026 | |
| 2.4.0 | 118 | 7/10/2026 | |
| 2.3.0 | 113 | 7/4/2026 | |
| 2.2.0 | 122 | 7/1/2026 | |
| 2.1.0 | 112 | 6/28/2026 | |
| 2.0.0 | 120 | 6/27/2026 | |
| 1.1.0 | 118 | 6/26/2026 | |
| 1.0.1 | 123 | 6/24/2026 | |
| 1.0.0 | 155 | 6/21/2026 | |
| 1.0.0-rc.5 | 95 | 6/12/2026 | |
| 1.0.0-rc.4 | 97 | 6/10/2026 | |
| 1.0.0-rc.3 | 94 | 6/7/2026 | |
| 1.0.0-rc.2 | 92 | 6/7/2026 | |
| 1.0.0-rc.1 | 93 | 6/7/2026 | |
| 0.5.0-beta | 138 | 5/21/2026 | |
| 0.4.0-beta | 127 | 5/14/2026 | |
| 0.3.0-beta | 140 | 5/13/2026 | |
| 0.0.10-beta | 227 | 12/13/2025 |