SelectPdf.Universal 26.4.0

Prefix Reserved
dotnet add package SelectPdf.Universal --version 26.4.0
                    
NuGet\Install-Package SelectPdf.Universal -Version 26.4.0
                    
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="SelectPdf.Universal" Version="26.4.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SelectPdf.Universal" Version="26.4.0" />
                    
Directory.Packages.props
<PackageReference Include="SelectPdf.Universal" />
                    
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 SelectPdf.Universal --version 26.4.0
                    
#r "nuget: SelectPdf.Universal, 26.4.0"
                    
#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 SelectPdf.Universal@26.4.0
                    
#: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=SelectPdf.Universal&version=26.4.0
                    
Install as a Cake Addin
#tool nuget:?package=SelectPdf.Universal&version=26.4.0
                    
Install as a Cake Tool

SelectPdf Library for .NET — Cross-Platform (Windows, Linux, macOS)

SelectPdf

SelectPdf is a professional PDF library for creating, writing, editing and reading PDF files entirely in C#/VB.NET — no Adobe Acrobat required. It includes a state-of-the-art HTML to PDF converter built on Chromium (HTML5, CSS3, web fonts, modern JavaScript) and a Word to PDF converter (DOCX, DOC, RTF and more).

This package is cross-platform: it runs on Windows (x64, x86), Linux (x64, ARM64) and macOS (Apple Silicon), on .NET 10, .NET 9, .NET 8 and .NET Standard 2.0 (consumable from .NET Framework 4.6.1+). It runs in Docker containers and on Microsoft Azure, Amazon Web Services and Google Cloud.

Installation

dotnet add package SelectPdf.Universal
dotnet add package SelectPdf.Universal.Native.win-x64      # or win-x86 / linux-x64 / linux-arm64 / osx-arm64

The managed SelectPdf.Universal package is AnyCPU and works on every platform (the assembly is SelectPdf.Universal.dll, namespace SelectPdf.Universal). Add the SelectPdf.Universal.Native.<rid> package that matches your runtime: it deploys the Chromium engine (HTML to PDF / HTML to image) and the native PDF tool (PDF to text / PDF to image) next to your application.

Native package Runtime
SelectPdf.Universal.Native.win-x64 Windows, 64-bit process
SelectPdf.Universal.Native.win-x86 Windows, 32-bit process
SelectPdf.Universal.Native.linux-x64 Linux x64 (glibc 2.30+)
SelectPdf.Universal.Native.linux-arm64 Linux ARM64 (glibc 2.30+)
SelectPdf.Universal.Native.osx-arm64 macOS 13+ on Apple Silicon

Quick start

HTML to PDF

using SelectPdf.Universal;

HtmlToPdf converter = new HtmlToPdf();
converter.Options.PdfPageSize = PdfPageSize.A4;
converter.Options.MarginTop = 20;
converter.Options.MarginBottom = 20;

PdfDocument doc = converter.ConvertUrl("https://selectpdf.com");
// or: converter.ConvertHtmlString("<h1>Hello</h1>", baseUrl);
doc.Save("page.pdf");
doc.Close();

Asynchronous conversion

HtmlToPdf converter = new HtmlToPdf();
PdfDocument doc = await converter.ConvertUrlAsync("https://selectpdf.com", cancellationToken);
doc.Save("page.pdf");
doc.Close();

Word to PDF

WordToPdf converter = new WordToPdf();
converter.Options.PdfStandard = PdfStandard.PdfA2B;   // optional: archival output

PdfDocument doc = converter.ConvertFile("contract.docx");
doc.Save("contract.pdf");
doc.Close();

Create a PDF from scratch

PdfDocument doc = new PdfDocument();
PdfPage page = doc.AddPage();

PdfFont font = doc.Fonts.Add(PdfStandardFont.Helvetica);
font.Size = 20;
page.Add(new PdfTextElement(50, 50, "Hello world!", font));

// html, images, shapes, links and bookmarks can be added too
page.Add(new PdfHtmlElement(50, 100, 400, "<p>Some <b>html</b> content</p>", null));

doc.Save("hello.pdf");
doc.Close();

Redact content

PdfRedactionManager redaction = new PdfRedactionManager();
redaction.Load("statement.pdf");
redaction.OverlayText = "[REDACTED]";
redaction.AddRedaction("John Smith", false, true);                                          // text
redaction.AddRedaction(new System.Text.RegularExpressions.Regex(@"\d{3}-\d{2}-\d{4}"));   // pattern
redaction.Save("statement-redacted.pdf");   // the content is removed from the file, not just covered
redaction.Close();

Sign and validate signatures

PdfSecurityManager signer = new PdfSecurityManager();
signer.Load("contract.pdf");
signer.Sign("certificate.pfx", "pfxPassword");
signer.Save("contract-signed.pdf");
signer.Close();

PdfSecurityManager validator = new PdfSecurityManager();
validator.Load("contract-signed.pdf");
foreach (PdfSignatureValidationResult result in validator.ValidateSignatures())
    Console.WriteLine($"{result.SignerName}: {result.Status}");
validator.Close();

Encrypt, merge, accessibility and archiving

PdfDocument doc = new PdfDocument("report.pdf");
doc.Append("appendix.pdf");                       // merge
doc.Security.OwnerPassword = "owner";             // AES-256 by default
doc.Security.UserPassword = "user";
doc.Security.CanCopyContent = false;
doc.Save("report-protected.pdf");
doc.Close();

HtmlToPdf converter = new HtmlToPdf();
converter.Options.PdfStandard = PdfStandard.PdfA4;                 // PDF/A-4
converter.Options.AccessibilityStandard = PdfUAStandard.UA2;       // tagged, PDF/UA-2
converter.Options.Title = "Annual report";
converter.Options.Language = "en-US";

PDF to text and PDF to image

PdfToText pdfToText = new PdfToText();
pdfToText.Load("document.pdf");
string text = pdfToText.GetText();

PdfRasterizer rasterizer = new PdfRasterizer();
rasterizer.Load("document.pdf");
byte[][] pngPages = rasterizer.ConvertToImages();

Main Features

PDF documents

  • Generate PDF documents from scratch; load, modify and save existing PDFs
  • Page elements: text, images (PNG, JPEG, GIF, BMP, WebP, TIFF), HTML, HTML rendered as images, Word content, shapes, links, attachments, notes
  • Reusable templates, headers and footers (also per page), watermarks and stamps, page numbering, bookmarks, page rotation
  • Merge PDF documents; resize and reflow existing pages; PDF portfolios; open actions
  • AcroForm filling and flattening
  • Redaction: remove text (by value or regular expression), images, graphics, links and form fields from marked areas, optionally with an overlay label
  • Compression of images, content streams and fonts
  • PDF to text (extract, search, text in a region) and PDF to image (PNG, JPEG, BMP, GIF, TIFF)

HTML to PDF converter (Chromium)

  • Convert any web page or HTML string to PDF, synchronously or asynchronously with cancellation
  • Page size, orientation, margins, content resizing, page breaks, repeated table headers, @media screen and print
  • HTML headers and footers, automatic bookmarks, internal and external links, table of contents, web element locations
  • HTTP headers, cookies, POST data, authentication, login forms, proxy servers
  • Conversion delay, navigation timeout, lazy image loading, JavaScript control, startup and post-loading scripts, custom CSS, element clicks
  • Partial conversion (CSS selector), hidden elements, single-page PDF output
  • HTML to image (PNG) converter
  • Fast in-process engine by default, with up to 8 conversions running concurrently (configurable); any conversion can be isolated in its own engine process

Word to PDF converter

  • DOCX, DOCM, DOTX, DOTM, DOC, DOT, RTF, TXT, WordML, HTML and Markdown input, encrypted documents included
  • Keep the document's own page sizes or reflow onto the page size and margins you choose
  • Outline from headings or Word bookmarks; headers, footers, security, PDF/A and PDF/UA output like the HTML converter
  • Word content in PDF pages, headers and footers

Security and signatures

  • RC4, AES and AES-GCM encryption, up to 256-bit keys (AES-256 by default), granular permissions, optional unencrypted XMP metadata
  • Digital signatures (SHA-256) with visible appearance and RFC-3161 time stamps
  • Signature validation: integrity, trust chain, coverage, time stamp and revocation status

Standards and accessibility

  • PDF/A-1b, PDF/A-2b, PDF/A-3b, PDF/A-3u, PDF/A-3a, PDF/A-4, PDF/A-4e, PDF/A-4f and PDF/X-1a
  • Tagged, accessible PDF: PDF/UA-1 and PDF/UA-2, from HTML, from Word and from scratch
  • PDF/A-3 associated files; ZUGFeRD / Factur-X electronic invoices; custom XMP metadata schemas

Deployment notes

  • Linux: the native packages bundle the Chromium shared libraries, so conversions run on minimal distributions and in containers without apt-get. Requires glibc 2.30+ (Debian 11+, Ubuntu 20.04+, RHEL 9+); Alpine/musl is not supported.
  • Docker: the official .NET images work as they are on Linux, with no --shm-size or GPU; Windows containers need Windows Server Core with the core Windows fonts installed.
  • Azure: App Service (Basic plan or above) and Azure Functions on a Dedicated plan, on Windows and Linux.
  • Cloud: verified on Azure App Service, Azure Functions (Dedicated and Premium plans) and Azure Container Apps, AWS Lambda (container image, x64 and arm64) and AWS Elastic Beanstalk, and Google Cloud Run, with a step-by-step page for each in the documentation.
  • Fonts: Linux hosts and container images often have no fonts, and the fonts built into the library cover Latin scripts only. Add SelectPdf.Universal.Fonts (Noto fonts for every script, copied next to the application on Linux and macOS) to render every language; your own fonts go in a fonts folder next to the application, on every platform.
  • Engine hosting: the Chromium engine runs inside your application when the native package matches your process architecture (a 32-bit Windows process, such as a default Windows App Service worker, uses win-x86); with another package, conversions run in a separate engine process automatically. Set GlobalProperties.ChromiumEngineHostMode = ChromiumEngineHostMode.OutOfProcess to run every conversion in its own engine process.
  • Native debug symbols: SkiaSharp 3.119.2 and later ship libSkiaSharp.pdb / libHarfBuzzSharp.pdb (about 300 MB for the Windows architectures) as runtime files, which the application never uses (SkiaSharp #3519). This package leaves them out of your build and publish output and your .deps.json; set <SelectPdfKeepNativeSymbols>true</SelectPdfKeepNativeSymbols> in your project to keep them.

Migrating to SelectPdf.Universal

SelectPdf.Universal is the cross-platform successor of the Windows-only Select.Pdf / Select.Pdf.NetCore packages. It keeps their classes and members, so porting is mostly mechanical:

  1. Replace the Select.Pdf* package references (and the Chromium / Blink companion packages) with SelectPdf.Universal plus a SelectPdf.Universal.Native.<rid> package, and remove Select.Html.dep, Select.Tools.dep and the old engine folders from the project.
  2. Change using SelectPdf; to using SelectPdf.Universal;.
  3. Replace System.Drawing types: PdfColor for colors, SelectPdf.Universal.Drawing for points, rectangles and sizes, PdfFont / PdfSystemFont for fonts, Stream or byte[] for images (HtmlToImage and PdfRasterizer return encoded images as byte[]).
  4. HTML is rendered with Chromium only: remove WebKit / Blink engine selection and settings, rename CefEnginePath to ChromiumEnginePath, and review the output of pages that rendered with the WebKit default.
  5. Use PdfDocument.Append instead of PdfMergeManager. PdfPrinter and the Select.Pdf.Extras add-on have no counterpart.

License keys issued for version 26 or later keep working. The documentation's Migrating to SelectPdf.Universal topic lists every change, the defaults that differ and how fonts are found on each platform.

Documentation & Support

Copyright © Outside Software SRL. All rights reserved.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  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 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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
26.4.0 151 10/5/2026