Spire.Printing
11.1.0
dotnet add package Spire.Printing --version 11.1.0
NuGet\Install-Package Spire.Printing -Version 11.1.0
<PackageReference Include="Spire.Printing" Version="11.1.0" />
<PackageVersion Include="Spire.Printing" Version="11.1.0" />
<PackageReference Include="Spire.Printing" />
paket add Spire.Printing --version 11.1.0
#r "nuget: Spire.Printing, 11.1.0"
#:package Spire.Printing@11.1.0
#addin nuget:?package=Spire.Printing&version=11.1.0
#tool nuget:?package=Spire.Printing&version=11.1.0
Spire.Printing: Powerful Cross-Platform Printing Library for .NET Developers
Product Page 丨 Documentation 丨 Examples 丨 Forum 丨 Temporary License 丨 Customized Demo
Spire.Printing is a robust, standalone printing library designed specifically for .NET developers to seamlessly integrate professional printing capabilities into their applications. As a completely independent tool, it runs without any external dependencies in .NET environments, eliminating the need for cumbersome third-party components. It natively supports cross-platform document printing for the latest .NET frameworks including .NET 6.0, .NET 9.0, and .NET 10.0, ensuring compatibility across diverse development scenarios.
Spire.Printing enables silent printing and flexible custom print settings—all without relying on Office Interop, helping developers avoid the limitations and compatibility issues associated with Office-related dependencies.
Full .NET Support:
- Compatible with .NET5.0, .NET 6.0, .NET 9.0, and .NET 10.0 frameworks.
OS & Processors:
- Windows (x64, x86)
- Linux (x64, ARM)
- Mac (x64, ARM)
Get All Printer Information
- Printer Names
- Retrieve Printer Names
Apply Custom Print Settings
- Adjust Paper Settings
- Set Paper Size
- Set Paper Portrait Orientation
- Set the Number of Copies
- Set the Print Range
- Specify the Printer Name
- Print collated
- Print uncollated
- Print on Both Sides
- Print in Grayscale
- Print to specified file name
Print Your Documents
- On Windows, Print the .xps file format,
- On Linux & Mac, Print .pdf file format
Control the Printing Process
- Silent Printing
- Record printing logs
Note: The trial version only supports printing the first 10 pages of the PDF. After you apply a license, the page limits will be lifted.
Method to remove the page limitations:
Spire.Doc.License.LicenseProvider.SetLicenseKey(string key);
Spire.Xls.License.LicenseProvider.SetLicenseKey(string key);
Spire.Pdf.License.LicenseProvider.SetLicenseKey(string key);
Spire.Presentation.License.LicenseProvider.SetLicenseKey(string key);
Use PrintDocument class to print the document directly.
using Spire.Printing;
IPrintDocumentStream documentStream;
if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows))
{
// Windows
documentStream = new XpsPrintDocument("test.xps");
}
else
{
// Non-Windows
documentStream = new PdfPrintDocument("test.pdf");
}
PrintDocument printDocument = new PrintDocument(documentStream);
printDocument.PrintSettings.PaperSize = PaperSize.A4;
//Check if duplex printing is supported
if (printDocument.PrintSettings.CanDuplex)
{
//Print in duplex
printDocument.PrintSettings.Duplex = Duplex.Vertical;
}
printDocument.PrintSettings.SelectPageRange(2, 5);
// Print to file
printDocument.PrintSettings.PrintToFile("toXps.xps");
printDocument.Print();
Implement cross-platform printing with Spire.PDF
using Spire.Pdf;
using Spire.Printing;
//Check the system
bool isWindows = System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows);
using (PdfDocument pdfDocument = new PdfDocument())
{
//Use Spire.PDF to save documents as. xps or. pdf document streams
pdfDocument.LoadFromFile("test.pdf");
Spire.Pdf.FileFormat fileFormat = !isWindows ? Spire.Pdf.FileFormat.PDF : Spire.Pdf.FileFormat.XPS;
MemoryStream stream = new MemoryStream();
pdfDocument.SaveToStream(stream, fileFormat);
//Convert to IPrintDocumentStream according to the system
IPrintDocumentStream pdfStream = !isWindows ? new PdfPrintDocument(stream) : new XpsPrintDocument(stream);
//Print
PrintDocument printPdf = new PrintDocument(pdfStream);
printPdf.PrintSettings.SelectPageRange(1, 1);
printPdf.Print();
//Dispose
printPdf.Dispose();
}
Implement cross-platform printing with Spire.Presentation
using Spire.Presentation;
using Spire.Printing;
//Check the system
bool isWindows = System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows);
using (Presentation ppt = new Presentation())
{
//Use Spire.Presentation to save documents as. xps or. pdf document streams
ppt.LoadFromFile("test.pptx");
Spire.Presentation.FileFormat fileFormat = !isWindows ? Spire.Presentation.FileFormat.PDF : Spire.Presentation.FileFormat.XPS;
MemoryStream stream = new MemoryStream();
ppt.SaveToFile(stream, fileFormat);
//Convert to IPrintDocumentStream according to the system
IPrintDocumentStream pptStream = !isWindows ? new PdfPrintDocument(stream) : new XpsPrintDocument(stream);
//Print
PrintDocument printPpt = new PrintDocument(pptStream);
printPpt.PrintSettings.SelectPageRange(1, 1);
printPpt.Print();
//Dispose
printPpt.Dispose();
}
Implement cross-platform printing with Spire.XLS
using Spire.Printing;
using Spire.Xls;
//Check the system
bool isWindows = System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows);
using (Workbook wb = new Workbook())
{
//Use Spire.Xls to save documents as. xps or. pdf document streams
wb.LoadFromFile("test.xlsx");
Spire.Xls.FileFormat fileFormat = !isWindows ? Spire.Xls.FileFormat.PDF : Spire.Xls.FileFormat.XPS;
MemoryStream stream = new MemoryStream();
wb.SaveToStream(stream, fileFormat);
//Convert to IPrintDocumentStream according to the system
IPrintDocumentStream xlsStream = !isWindows ? new PdfPrintDocument(stream) : new XpsPrintDocument(stream);
//Print
PrintDocument printxls = new PrintDocument(xlsStream);
printxls.PrintSettings.SelectPageRange(1, 1);
printxls.Print();
//Dispose
printxls.Dispose();
}
Implement cross-platform printing with Spire.Doc
using Spire.Doc;
using Spire.Printing;
//Check the system
bool isWindows = System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows);
using (Document document = new Document())
{
//Use Spire.Doc to save documents as. xps or. pdf document streams
document.LoadFromFile(@"test.docx");
Spire.Doc.FileFormat fileFormat = !isWindows ? Spire.Doc.FileFormat.PDF : Spire.Doc.FileFormat.XPS;
MemoryStream stream = new MemoryStream();
document.SaveToStream(stream, fileFormat);
//Convert to IPrintDocumentStream according to the system
IPrintDocumentStream docStream = !isWindows ? new PdfPrintDocument(stream) : new XpsPrintDocument(stream);
//Print
PrintDocument printDoc = new PrintDocument(docStream);
printDoc.PrintSettings.SelectPageRange(1, 1);
printDoc.Print();
//Dispose
printDoc.Dispose();
}
Product Page 丨 Documentation 丨 Examples 丨 Forum 丨 Temporary License 丨 Customized Demo
| Product | Versions 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 was computed. 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 was computed. 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. |
-
net6.0
- System.Buffers (>= 4.5.1)
- System.Memory (>= 4.5.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.