CodeBrix.PdfDocCreate.MitLicenseForever
1.0.238.1192
dotnet add package CodeBrix.PdfDocCreate.MitLicenseForever --version 1.0.238.1192
NuGet\Install-Package CodeBrix.PdfDocCreate.MitLicenseForever -Version 1.0.238.1192
<PackageReference Include="CodeBrix.PdfDocCreate.MitLicenseForever" Version="1.0.238.1192" />
<PackageVersion Include="CodeBrix.PdfDocCreate.MitLicenseForever" Version="1.0.238.1192" />
<PackageReference Include="CodeBrix.PdfDocCreate.MitLicenseForever" />
paket add CodeBrix.PdfDocCreate.MitLicenseForever --version 1.0.238.1192
#r "nuget: CodeBrix.PdfDocCreate.MitLicenseForever, 1.0.238.1192"
#:package CodeBrix.PdfDocCreate.MitLicenseForever@1.0.238.1192
#addin nuget:?package=CodeBrix.PdfDocCreate.MitLicenseForever&version=1.0.238.1192
#tool nuget:?package=CodeBrix.PdfDocCreate.MitLicenseForever&version=1.0.238.1192
CodeBrix.PdfDocuments
Create and process PDF documents using .NET, without the need of interop.
CodeBrix.PdfDocuments is a .NET library for creating, reading, merging, and manipulating PDF documents. CodeBrix.PdfDocCreate is a companion library that provides a document object model for building richly formatted PDF documents with styled text, tables, charts, and images. CodeBrix.PdfRasterizer is a companion library that renders PDF pages to images (PNG, JPEG, BMP, GIF, TIFF) using the PDFium native rendering engine, with support for thumbnails, page information, and cross-platform operation.
CodeBrix.PdfDocuments has dependencies on the CodeBrix.Imaging package for image and font handling, and the CodeBrix.Compression package for data compression. CodeBrix.PdfRasterizer has dependencies on CodeBrix.PdfDocuments and the CodeBrix.Imaging package, and bundles pre-built PDFium native binaries for Windows, macOS, Linux, and Android.
CodeBrix.PdfDocCreate.Html2Pdf is a companion library that renders author-created HTML pages with CSS styling into PDF documents, and CodeBrix.PdfDocCreate.Markdown2Pdf is a companion library that renders any Markdown (.md) file into a nice-looking, pre-formatted, printable PDF with zero configuration.
CodeBrix.PdfDocuments, CodeBrix.PdfDocCreate, CodeBrix.PdfRasterizer, CodeBrix.PdfDocCreate.Html2Pdf,
and CodeBrix.PdfDocCreate.Markdown2Pdf are provided as .NET 10 libraries and associated
CodeBrix.PdfDocuments.MitLicenseForever, CodeBrix.PdfDocCreate.MitLicenseForever,
CodeBrix.PdfRasterizer.MitLicenseForever, CodeBrix.PdfDocCreate.Html2Pdf.MitLicenseForever, and
CodeBrix.PdfDocCreate.Markdown2Pdf.MitLicenseForever NuGet packages.
CodeBrix.PdfDocuments supports applications and assemblies that target Microsoft .NET version 10.0 and later. Microsoft .NET version 10.0 is a Long-Term Supported (LTS) version of .NET, and was released on Nov 11, 2025; and will be actively supported by Microsoft until Nov 14, 2028. Please update your C#/.NET code and projects to the latest LTS version of Microsoft .NET.
CodeBrix.PdfDocuments is a fork of the code of the popular PdfSharpCore library version 1.3.67 and the MigraDocCore libraries version 1.3.67 - see below for licensing details.
Installation
The five packages are complementary rather than alternatives, and each one brings in the ones below it. Reference the highest-level package that does what you need:
dotnet add package CodeBrix.PdfDocuments.MitLicenseForever
| Package ID | Use it for | Brings in |
|---|---|---|
CodeBrix.PdfDocuments.MitLicenseForever |
Drawing at exact coordinates, reading, merging, encrypting | CodeBrix.Imaging, CodeBrix.Compression |
CodeBrix.PdfDocCreate.MitLicenseForever |
Sections, styles, tables, automatic pagination | PdfDocuments |
CodeBrix.PdfDocCreate.Html2Pdf.MitLicenseForever |
Rendering author-written HTML + CSS | PdfDocCreate, MarkupParse, StyleSheetParse, the font packages, and the fully managed drawing engine |
CodeBrix.PdfDocCreate.Markdown2Pdf.MitLicenseForever |
Rendering Markdown with zero configuration | Html2Pdf |
CodeBrix.PdfRasterizer.MitLicenseForever |
Turning finished PDF pages back into images | PdfDocuments, CodeBrix.Imaging, and the bundled PDFium natives |
Note that the NuGet package IDs carry a .MitLicenseForever suffix that the assemblies and
namespaces do not - there is no package named plain CodeBrix.PdfDocuments. The suffix is a
CodeBrix family convention recording the license the package will always be published under.
CodeBrix.PdfRasterizer is the only package with a native component: it bundles pre-built PDFium
binaries and needs no separate native-asset package on any supported platform. The other four are
fully managed.
CodeBrix.PdfDocuments supports:
- Creating PDF documents from scratch
- Reading and modifying existing PDF documents
- Merging multiple PDF documents
- Drawing text, images, and graphics on PDF pages
- Multi-stop linear and radial gradients as PDF shading patterns, and transparency groups with constant opacity and PDF blend modes
- Unicode text and metadata
- Document information (title, author, subject, etc.)
- Page formatting and layout
- Text formatting with custom fonts and styles
- Image embedding (PNG, JPEG, etc.)
- PDF security and encryption
- Document outlines and bookmarks
- Image data consolidation for optimized file sizes
CodeBrix.PdfDocCreate additionally supports:
- Document object model for structured PDF creation
- Styled paragraphs with headings and body text
- Tables with formatted cells
- Charts
- Page headers and footers
- Paragraph alignment and spacing
CodeBrix.PdfRasterizer supports:
- Rasterizing PDF pages to in-memory images or image files
- Rasterizing a single page or all pages at once
- Output in multiple image formats: PNG, JPEG, BMP, GIF, TIFF
- Configurable rendering resolution (DPI)
- Thumbnail generation with configurable maximum dimensions
- Page information: page count and page dimensions (points, inches, pixels)
- Encrypted/password-protected PDF support
- Selective page rasterization (specific page numbers)
- Configurable background color
- Custom file name generation for output files
- Form field rendering (fillable PDF forms)
- CancellationToken support for async operations
- Accepts PDF input from file paths, byte arrays, streams, or PdfDocument objects
- Cross-platform: Windows (x64, x86, ARM64), macOS (x64, ARM64), Linux (x64, ARM64, ARM, RISC-V 64), Android (ARM64)
CodeBrix.PdfDocCreate.Html2Pdf supports:
CodeBrix.PdfDocCreate.Html2Pdf (CodeBrix.PdfDocCreate.Html2Pdf.MitLicenseForever) renders
author-created HTML pages with CSS styling into PDF documents. It is designed for HTML/CSS written
for PDF generation - it is not a web browser.
- HTML parsing via CodeBrix.MarkupParse, CSS parsing via CodeBrix.StyleSheetParse
- A documented CSS dialect applied with real selector matching, cascade, specificity, and inheritance
- Inline
styleattributes,<style>blocks, and linked local stylesheets @pagerules for page size, orientation, and margins- Headings (with PDF outline/bookmarks), paragraphs, nested lists, definition lists, blockquotes,
code blocks, tables (colspan and rowspan, content-measured column widths), images, and links
(including in-document
#anchorlinks) - Every image format CodeBrix.Imaging decodes (PNG, JPEG, BMP, WebP, GIF, TIFF, TGA, PBM/PGM/PPM), with transparency preserved, as local files, data: URIs, or (opt-in) http(s) URLs
- SVG images - referenced files,
data:image/svg+xmlURIs, and inline<svg>elements - placed as PDF vector content by default (paths, strokes, clips, transforms, SVG text as real selectable and searchable PDF text in the embedded font, linear/radial gradients as PDF shading patterns, and group opacity as a PDF transparency group - sharp at any zoom), or rasterized on request, identically on Windows, macOS, and Linux, with no native dependency of any kind - Headers/footers with page-number tokens
- All text rendered with the CodeBrix.Platform.Fonts packages (Roboto, Merriweather, Roboto Mono), automatically copied into the application output - identical PDF output on every operating system
- Consumer font registration (loose
.ttf/.otffiles, no manifest needed) usable from CSS and SVG text, with per-glyph fallback decided against each font's actual character coverage - Unsupported CSS and missing resources degrade to collectable warnings, never exceptions
CodeBrix.PdfDocCreate.Markdown2Pdf supports:
CodeBrix.PdfDocCreate.Markdown2Pdf (CodeBrix.PdfDocCreate.Markdown2Pdf.MitLicenseForever) renders
any Markdown (.md) file into a nice-looking, pre-formatted, printable PDF with zero configuration.
- A faithful C# port of the markdown-it CommonMark parser (verified against the full CommonMark specification test corpus)
- GFM tables and strikethrough, footnotes, GitHub task lists, and YAML front matter
- Automatic syntax highlighting for common fenced-code languages
- A polished built-in print style: Merriweather body text, Roboto headings, Roboto Mono code, footer page numbers, and a PDF outline built from the headings
- Title and author inference from front matter, the first heading, or the file name
- Embedded HTML rendered through the Html2Pdf element subset
- A restyling workflow:
GenerateHtmlreturns the ready-to-render HTML/CSS so consumers can replace the stylesheet and render the result with Html2Pdf themselves
Sample Code
Create a Simple PDF
using CodeBrix.PdfDocuments.Drawing;
using CodeBrix.PdfDocuments.Pdf;
// Create a new PDF document
var document = new PdfDocument();
// Add a page and create a graphics renderer
var page = document.AddPage();
var renderer = XGraphics.FromPdfPage(page);
// Draw text on the page
renderer.DrawString(
"Hello, PDF!",
new XFont("Arial", 24),
XBrushes.Black,
new XPoint(50, 50));
// Save the document
document.Save("HelloPdf.pdf");
Create a PDF with Images
using CodeBrix.PdfDocuments.Drawing;
using CodeBrix.PdfDocuments.Pdf;
var document = new PdfDocument();
var page = document.AddPage();
var renderer = XGraphics.FromPdfPage(page);
// Draw text
renderer.DrawString("PDF with Image", new XFont("Arial", 16), XBrushes.Black, new XPoint(12, 24));
// Draw an image from file
renderer.DrawImage(XImage.FromFile("photo.png"), new XPoint(12, 50));
document.Save("ImageDocument.pdf");
Read and Merge PDF Documents
using CodeBrix.PdfDocuments.Pdf;
using CodeBrix.PdfDocuments.Pdf.IO;
// Open existing PDF files and merge them
var outputDocument = new PdfDocument();
foreach (var pdfPath in new[] { "document1.pdf", "document2.pdf" })
{
using var fs = File.OpenRead(pdfPath);
var inputDocument = PdfReader.Open(fs, PdfDocumentOpenMode.Import);
for (var i = 0; i < inputDocument.PageCount; i++)
{
outputDocument.AddPage(inputDocument.Pages[i]);
}
}
outputDocument.Save("merged.pdf");
Create a Styled Document with CodeBrix.PdfDocCreate
using CodeBrix.PdfDocCreate.DocumentObjectModel;
using CodeBrix.PdfDocCreate.Rendering;
// Create a document with styled content
var doc = new Document
{
Info =
{
Title = "Sales Report",
Subject = "Quarterly Sales Data",
Author = "CodeBrix"
}
};
// Define styles
var titleStyle = doc.AddStyle("Title", "Normal");
titleStyle.Font.Size = 24;
titleStyle.Font.Bold = true;
titleStyle.ParagraphFormat.SpaceAfter = 6;
titleStyle.ParagraphFormat.Alignment = ParagraphAlignment.Center;
var bodyStyle = doc.Styles["Normal"];
bodyStyle.Font.Size = 10;
bodyStyle.ParagraphFormat.SpaceAfter = 4;
// Add content
var section = doc.AddSection();
var titleParagraph = section.AddParagraph("Quarterly Sales Report");
titleParagraph.Style = "Title";
var bodyParagraph = section.AddParagraph("This report summarizes quarterly sales data.");
bodyParagraph.Style = "Normal";
// Render to PDF
var pdfRenderer = new PdfDocumentRenderer { Document = doc };
pdfRenderer.RenderDocument();
pdfRenderer.PdfDocument.Save("SalesReport.pdf");
Rasterize PDF Pages to Image Files
using CodeBrix.PdfRasterizer;
// Create a rasterizer instance
using var rasterizer = new PageRasterizer();
// Configure output settings
rasterizer.OutputDirectory = @"C:\Output\Images";
rasterizer.Dpi = 300;
// Rasterize all pages of a PDF to PNG files
await rasterizer.RasterizeToImageFiles("report.pdf");
Rasterize a Single PDF Page to an In-Memory Image
using CodeBrix.Imaging;
using CodeBrix.Imaging.Formats.Jpeg;
using CodeBrix.PdfRasterizer;
using var rasterizer = new PageRasterizer();
// Rasterize page 1 as a JPEG image
using var image = await rasterizer.RasterizeToImage(
"report.pdf",
pageNumber: 1,
desiredImageFormat: JpegFormat.Instance);
// Save the image to a file
await image.SaveAsync("page1.jpg");
// Or access image properties
Console.WriteLine($"Image size: {image.Width} x {image.Height}");
Generate Thumbnails
using CodeBrix.Imaging;
using CodeBrix.PdfRasterizer;
using var rasterizer = new PageRasterizer();
// Generate thumbnails with custom max dimensions (150x200 pixels)
var maxDimensions = new ThumbnailMaxDimensions(150, 200);
IList<Image> thumbnails = await rasterizer.RasterizeToThumbnails(
"report.pdf",
maxDimensions: maxDimensions);
foreach (var thumbnail in thumbnails)
{
Console.WriteLine($"Thumbnail size: {thumbnail.Width} x {thumbnail.Height}");
thumbnail.Dispose();
}
Get PDF Page Information
using CodeBrix.PdfRasterizer;
using var rasterizer = new PageRasterizer();
// Get the number of pages
int pageCount = await rasterizer.GetPageCount("report.pdf");
Console.WriteLine($"Page count: {pageCount}");
// Get dimensions of a specific page
PdfPageDimensions dims = await rasterizer.GetPageDimensions("report.pdf", pageNumber: 1);
Console.WriteLine($"Page size: {dims.WidthInInches:F1}\" x {dims.HeightInInches:F1}\"");
Console.WriteLine($"At 300 DPI: {dims.GetWidthInPixels(300)} x {dims.GetHeightInPixels(300)} pixels");
Rasterize Pages from a PdfDocument Object
using CodeBrix.Imaging;
using CodeBrix.PdfDocuments.Pdf;
using CodeBrix.PdfRasterizer;
// Create a PDF document programmatically
var document = new PdfDocument();
var page = document.AddPage();
// ... draw content on the page ...
// Rasterize the in-memory document directly
using var rasterizer = new PageRasterizer();
IList<Image> images = await rasterizer.RasterizeToImages(document);
foreach (var image in images)
{
// Process the image...
image.Dispose();
}
Render HTML with CSS to PDF
using CodeBrix.PdfDocCreate.Html2Pdf;
var renderer = new HtmlPdfRenderer();
renderer.Options.FooterText = "Page {page} of {pages}";
var result = renderer.RenderFile("report.html", "report.pdf");
Console.WriteLine($"{result.PageCount} page(s), {result.Warnings.Count} warning(s)");
Render Markdown to PDF (zero configuration)
using CodeBrix.PdfDocCreate.Markdown2Pdf;
var renderer = new MarkdownPdfRenderer();
// Writes my_notes.pdf next to the source file
var result = renderer.RenderFile("my_notes.md");
Console.WriteLine($"'{result.Title}': {result.PageCount} page(s)");
Restyle the generated Markdown HTML before rendering
using CodeBrix.PdfDocCreate.Html2Pdf;
using CodeBrix.PdfDocCreate.Markdown2Pdf;
var markdownRenderer = new MarkdownPdfRenderer();
var generated = markdownRenderer.GenerateHtmlFromFile("my_notes.md");
var myCss = generated.Css + "\nh1 { color: #7a1f1f; }";
var html = generated.ToHtmlDocument(myCss);
var htmlRenderer = new HtmlPdfRenderer();
htmlRenderer.RenderHtml(html, "restyled.pdf", generated.BaseDirectory);
Documentation
Every one of the five NuGet packages includes its own AGENT-README.txt - a complete API reference
and usage guide written for AI coding agents, specific to the package you referenced. Point your
agent at that file when it is writing code against these libraries.
Significant additional sample code is available in the CodeBrix.PdfDocuments.Tests,
CodeBrix.PdfDocCreate.Html2Pdf.Tests, and CodeBrix.PdfDocCreate.Markdown2Pdf.Tests projects:
https://github.com/ellisnet/CodeBrix.PdfDocuments/tree/main/tests
These libraries create and render PDFs; they do not extract text from existing ones. There is no text extraction or OCR, no digital signing or verification, no PDF/A or PDF/X compliance generation, no creation of new form fields (existing ones can be read, filled and flattened), and no editing of existing page content in place - you can draw over or under it, or replace a content stream wholesale, but not change a word where it sits.
License
The project is licensed under the MIT License. see: https://en.wikipedia.org/wiki/MIT_License
All code from PdfSharpCore version 1.3.67 and MigraDocCore version 1.3.67 was licensed under the MIT License. This project (CodeBrix.PdfDocuments/CodeBrix.PdfDocCreate) complies with all provisions of the open source license of PdfSharpCore and MigraDocCore (code) - and will make all modified, adapted and derived code within the CodeBrix.PdfDocuments/CodeBrix.PdfDocCreate libraries freely available as open source, under the same license as the PdfSharpCore and MigraDocCore code license.
CodeBrix.PdfRasterizer contains P/Invoke bindings and rendering logic derived from Docnet.Core (MIT License, copyright 2018 Modestas Petravicius). Pre-built PDFium native binaries are bundled under a BSD 3-Clause license (copyright 2014 The PDFium Authors). See THIRD-PARTY-NOTICES.txt in the root of the repository for full license details.
| 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
- CodeBrix.PdfDocuments.MitLicenseForever (>= 1.0.238.1192)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on CodeBrix.PdfDocCreate.MitLicenseForever:
| Package | Downloads |
|---|---|
|
CodeBrix.PdfDocCreate.Html2Pdf.MitLicenseForever
Renders author-created HTML pages with CSS styling into PDF documents via the CodeBrix.PdfDocCreate document object model. Applies a documented subset of CSS - inline style attributes, style blocks, and linked local stylesheets - with real selector matching, cascade, specificity, and inheritance. Embeds every image format CodeBrix.Imaging decodes plus SVG (referenced files, data: URIs, and inline svg elements, placed as PDF vector content by default, or rasterized on request - identically on Windows, macOS, and Linux, with no native dependency). All text is rendered with the CodeBrix.Platform.Fonts Roboto (sans-serif), Merriweather (serif), and Roboto Mono (monospace) font packages - plus any fonts the consumer registers - so output is identical on every operating system. Designed for HTML/CSS written for PDF generation, not for repurposing arbitrary web pages. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.238.1192 | 0 | 8/26/2026 |
| 1.0.238.580 | 7 | 8/26/2026 |
| 1.0.232.1177 | 115 | 8/20/2026 |
| 1.0.232.60 | 114 | 8/20/2026 |
| 1.0.217.117 | 118 | 8/5/2026 |
| 1.0.213.531 | 102 | 8/1/2026 |
| 1.0.174.112 | 125 | 6/23/2026 |
| 1.0.164.1341 | 124 | 6/13/2026 |
| 1.0.117 | 125 | 4/29/2026 |
| 1.0.101 | 129 | 4/12/2026 |
| 1.0.100 | 122 | 4/12/2026 |
| 1.0.74 | 149 | 3/17/2026 |
| 1.0.73 | 128 | 3/14/2026 |
| 1.0.71 | 132 | 3/13/2026 |
| 1.0.49 | 135 | 2/27/2026 |