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
<PackageReference Include="SelectPdf.Universal" Version="26.4.0" />
<PackageVersion Include="SelectPdf.Universal" Version="26.4.0" />
<PackageReference Include="SelectPdf.Universal" />
paket add SelectPdf.Universal --version 26.4.0
#r "nuget: SelectPdf.Universal, 26.4.0"
#:package SelectPdf.Universal@26.4.0
#addin nuget:?package=SelectPdf.Universal&version=26.4.0
#tool nuget:?package=SelectPdf.Universal&version=26.4.0
SelectPdf Library for .NET — Cross-Platform (Windows, Linux, macOS)
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,
@mediascreen 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-sizeor 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 afontsfolder 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. SetGlobalProperties.ChromiumEngineHostMode = ChromiumEngineHostMode.OutOfProcessto 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:
- Replace the
Select.Pdf*package references (and the Chromium / Blink companion packages) withSelectPdf.Universalplus aSelectPdf.Universal.Native.<rid>package, and removeSelect.Html.dep,Select.Tools.depand the old engine folders from the project. - Change
using SelectPdf;tousing SelectPdf.Universal;. - Replace
System.Drawingtypes:PdfColorfor colors,SelectPdf.Universal.Drawingfor points, rectangles and sizes,PdfFont/PdfSystemFontfor fonts,Streamorbyte[]for images (HtmlToImageandPdfRasterizerreturn encoded images asbyte[]). - HTML is rendered with Chromium only: remove WebKit / Blink engine selection and settings, rename
CefEnginePathtoChromiumEnginePath, and review the output of pages that rendered with the WebKit default. - Use
PdfDocument.Appendinstead ofPdfMergeManager.PdfPrinterand theSelect.Pdf.Extrasadd-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
- Documentation: https://selectpdf.com/pdf-library/
- Website: https://selectpdf.com/
- Community Edition (free HTML to PDF converter, up to 5 pages): https://www.nuget.org/packages/SelectPdf.HtmlToPdf.Universal
Copyright © Outside Software SRL. All rights reserved.
| Product | Versions 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. |
-
.NETStandard 2.0
- BitMiracle.LibTiff.NET (>= 2.4.649)
- HarfBuzzSharp (>= 8.3.1.5)
- HarfBuzzSharp.NativeAssets.Linux (>= 8.3.1.5)
- Newtonsoft.Json (>= 13.0.3)
- SkiaSharp (>= 3.119.4)
- SkiaSharp.HarfBuzz (>= 3.119.4)
- SkiaSharp.NativeAssets.Linux.NoDependencies (>= 3.119.4)
- System.Text.Encoding.CodePages (>= 4.4.0)
-
net10.0
- BitMiracle.LibTiff.NET (>= 2.4.649)
- HarfBuzzSharp (>= 8.3.1.5)
- HarfBuzzSharp.NativeAssets.Linux (>= 8.3.1.5)
- Newtonsoft.Json (>= 13.0.3)
- SkiaSharp (>= 3.119.4)
- SkiaSharp.HarfBuzz (>= 3.119.4)
- SkiaSharp.NativeAssets.Linux.NoDependencies (>= 3.119.4)
-
net8.0
- BitMiracle.LibTiff.NET (>= 2.4.649)
- HarfBuzzSharp (>= 8.3.1.5)
- HarfBuzzSharp.NativeAssets.Linux (>= 8.3.1.5)
- Newtonsoft.Json (>= 13.0.3)
- SkiaSharp (>= 3.119.4)
- SkiaSharp.HarfBuzz (>= 3.119.4)
- SkiaSharp.NativeAssets.Linux.NoDependencies (>= 3.119.4)
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 |
