Bsa.Pdf.Convert 1.0.42

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

Bsa.Pdf.Convert

Convert Word (.docx), Excel (.xlsx) and PDF documents to page images (PNG, JPEG, multi-page TIFF), and Word and Excel to PDF, in C#. No Microsoft Office, LibreOffice, Open XML SDK or headless browser: the package has its own layout engine (paragraphs, tables, headers and footers, footnotes, sections, text boxes, EMF/WMF pictures, Excel charts and print settings). Pages are rendered with PDFium. .NET 6, .NET 8, .NET 10 — Windows, Linux, macOS.

Documentation in Russian: README.ru.md in the package.

Installation

dotnet add package Bsa.Pdf.Convert

Usage

using System.IO;
using Bsa.Pdf.Convert;

var converter = new DocumentConverter(new ConvertOptions { Dpi = 150 });
var data = File.ReadAllBytes("report.docx");

// Word or Excel → PDF (a PDF input is returned as is)
File.WriteAllBytes("report.pdf", converter.ToPdf(data));

// Pages → PNG (or ImageFileFormat.Jpeg)
foreach (var page in converter.EnumerateImages(data))
{
    File.WriteAllBytes($"page-{page.Index + 1}.png", page.Data);
}

// First and third pages only, JPEG
var pages = converter.ToImages(data, ImageFileFormat.Jpeg, new[] { 0, 2 });

// All pages → one multi-page TIFF
File.WriteAllBytes("report.tiff", converter.ToTiff(data));

The input format is detected by content, not by file name. EnumerateImages keeps only the current page in memory; ToImages returns all pages at once. A DocumentConverter instance can be shared between threads.

Options

Option Default Meaning
Dpi 150 Image resolution, 36–600
JpegQuality 85 JPEG quality, 1–100
Password null Password of a protected PDF
FontFolders null Extra font folders searched before the system fonts
Culture current culture Excel number and date formats that follow the regional settings
DocumentName document File name for Excel header and footer fields (&F)

Fonts

Text is laid out with the fonts installed in the system (Windows Fonts, Linux /usr/share/fonts, ~/.fonts, macOS /Library/Fonts). Missing Microsoft fonts are replaced with metric-compatible ones: Arial → Liberation Sans, Times New Roman → Liberation Serif, Courier New → Liberation Mono, Calibri → Carlito, Cambria → Caladea. On a Linux server install them, for example fonts-liberation fonts-crosextra-carlito fonts-crosextra-caladea (Debian, Ubuntu, Astra Linux) — or put the document fonts into a folder and pass it in FontFolders.

Errors

Exception When
NotSupportedException The file is not PDF, .docx or .xlsx (legacy .doc and .xls are not supported)
Bsa.Pdf.Core.Rendering.PdfRenderException The PDF is damaged, or protected and Password is missing or wrong (IsPasswordRequired is true)
ArgumentOutOfRangeException A page index outside the document

License

BSD-2-Clause. PDFium (bblanchon.PDFium.*) — BSD-3-Clause and Apache-2.0.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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. 
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
1.0.42 46 11/20/2026