ExpertPdf Anywhere v22.0.0

Excel to PDF Converter for .NET

Convert Excel workbooks to PDF from C# and VB.NET without Microsoft Excel: XLSX, XLSM, XLTX, XLTM, XLS and XLT, comma and tab separated values, the Excel 2003 XML spreadsheet and Markdown tables. Every visible sheet is converted as Excel prints it, by a spreadsheet engine in the library, on Windows, Linux and macOS.

The Excel to PDF converter is part of ExpertPdf Anywhere, the .NET library with every ExpertPdf tool. Fit a sheet on one page, convert only some sheets, and get a bookmark for each sheet.

NuGet · ExpertPdf.Anywhere C# & VB.NET samples
Input XLSX, XLS, CSV, TSV, XML, Markdown
Output PDF bytes, file or stream
Runs on Windows, Linux and macOS

Everything Excel to PDF does.

Which sheets are converted and how they are printed, and how the PDF document comes out.

Workbooks & sheets

What goes in.

Workbooks from a file, a stream or bytes, printed without Microsoft Excel.

Excel formats

XLSX, XLSM, XLTX, XLTM, XLS and XLT, the Excel 2003 XML spreadsheet, CSV and tab separated values, and Markdown, whose tables become worksheets.

As Excel prints it

Every visible sheet in workbook order, with its print area, its page breaks and its own printed header and footer.

Some sheets

Worksheets converts only the sheets it names, for example "Summary, Q1"; PageRanges only some pages.

A bookmark for each sheet

Each sheet becomes a bookmark of the PDF document, with SheetBookmarks.

Blank sheets and pages

Empty sheets and empty pages are left out, or kept with ConvertBlankSheets and ConvertBlankPages.

Protected workbooks

Open a password protected workbook with Password. A workbook that cannot be read throws ExcelConvertException.

Page setup & output

How the PDF comes out.

The paper of each sheet or your own, scaling, gridlines and standards.

Page setup

Each sheet on the paper size, orientation and margins of its own page setup, or all of them on the page size and margins you set.

Fit on one page

The whole sheet, all its columns or all its rows on one page, with Layout.

Gridlines

Draw or hide the cell gridlines with GridLines, whatever the sheet sets.

Complex scripts

Arabic, Hebrew, Thai and other complex scripts the workbook does not mark are shaped with AutoDetectComplexScript.

PDF/A and PDF/UA

PDF/A and PDF/X documents, and tagged PDF/UA documents with the sheets' tables and header cells, and the alternative text of charts and pictures.

Form controls, header, footer, security

Form controls kept as PDF form fields, a header and a footer with page numbers, passwords and permissions, as in the HTML to PDF converter.

An Excel workbook, as a PDF.

Create a PdfConverter from ExpertPdf.Anywhere.ExcelToPdf, set the options and call one conversion method. The tabs fit a workbook's columns on landscape A4 pages, convert two named sheets, and a CSV file.

Program.cs · C#
using ExpertPdf.Anywhere.ExcelToPdf;

var converter = new PdfConverter();
// converter.LicenseKey = "your license key";

// Landscape A4 pages, all the columns of a sheet across one page
converter.PageSetup = ExcelPageSetup.Options;
converter.PdfDocumentOptions.PdfPageSize = PdfPageSize.A4;
converter.PdfDocumentOptions.PdfPageOrientation = PDFPageOrientation.Landscape;
converter.Layout = ExcelLayout.FitAllColumnsOnOnePage;
converter.GridLines = ExcelGridLines.Visible;

converter.SavePdfFromExcelFileToFile("sales.xlsx", "sales.pdf");

Install the package of your operating system, dotnet add package ExpertPdf.Anywhere.Windows (or .Linux, .Linux.Arm64, .MacOS); it brings the ExpertPdf Anywhere library with it. The Excel to PDF topic describes every option, and the online sample converts your own workbook.

Excel to PDF questions, answered.

Common questions about formats, sheets, page setup and licensing.

Does it need Microsoft Excel?
No. The workbook is laid out by a spreadsheet engine in the library. Nothing is installed on the server and no Office application is started, on Windows, Linux or macOS.
Which files can it convert?
XLSX, XLSM, XLTX, XLTM, XLS and XLT workbooks, comma and tab separated values, the Excel 2003 XML spreadsheet and Markdown, whose tables become worksheets. The format is found from the file extension or from the content; pass an ExcelFormat to set it (tab separated values and Markdown given as a stream must name it).
How are the sheets printed?
Every visible sheet is converted, in workbook order, as Excel prints it: its print area, its page breaks and its own printed header and footer. By default each sheet uses the paper size, orientation and margins of its own page setup; with ExcelPageSetup.Options the sheets are laid out on the page size, orientation and margins of PdfDocumentOptions.
Can I convert only some sheets?
Yes. Worksheets converts only the sheets it names, for example "Summary, Q1", and PageRanges only some pages. Each sheet becomes a bookmark of the PDF (SheetBookmarks).
How do I fit a wide sheet on one page?
Set Layout: FitAllColumnsOnOnePage fits all the columns of a sheet across one page, FitAllRowsOnOnePage all its rows, and FitSheetOnOnePage the whole sheet. GridLines draws or hides the cell gridlines.
Can it produce PDF/A or accessible PDF?
Yes. PdfStandardSubset produces PDF/A and PDF/X documents, and AccessibilityStandard tagged PDF/UA documents: the sheets' tables with their header cells, charts and pictures with their alternative text, and links. Set Language and the title for an accessible document.
What happens with a font the server does not have?
It is replaced by a font with the same metrics, so columns and pages break as in Excel. On Linux and macOS hosts without fonts (containers, for example), add the ExpertPdf.Anywhere.Fonts package.
How is it licensed?
Excel to PDF is part of ExpertPdf Anywhere, with every other ExpertPdf tool, from $700. Install it from NuGet and try every feature in evaluation mode, then license it on the pricing page. To create and edit workbooks, see the ExpertXLS Excel Library.

Convert Excel to PDF from .NET.

Install ExpertPdf Anywhere from NuGet and try every feature in evaluation mode. License it on the pricing page when you are ready.

Targets.NET Standard 2.0 · .NET 8 · .NET 10 · Windows · Linux · macOS
Versionv22.0.0