CG.Infrastructure.Printing
3.10.1
See the version list below for details.
dotnet add package CG.Infrastructure.Printing --version 3.10.1
NuGet\Install-Package CG.Infrastructure.Printing -Version 3.10.1
<PackageReference Include="CG.Infrastructure.Printing" Version="3.10.1" />
<PackageVersion Include="CG.Infrastructure.Printing" Version="3.10.1" />
<PackageReference Include="CG.Infrastructure.Printing" />
paket add CG.Infrastructure.Printing --version 3.10.1
#r "nuget: CG.Infrastructure.Printing, 3.10.1"
#:package CG.Infrastructure.Printing@3.10.1
#addin nuget:?package=CG.Infrastructure.Printing&version=3.10.1
#tool nuget:?package=CG.Infrastructure.Printing&version=3.10.1
Infrastructure.Printing
A .NET 9.0 Windows library that provides comprehensive printing capabilities for WPF applications, including file printing, PDF generation, and DataGrid document pagination.
Overview
This library offers a robust set of printing services designed to handle various printing scenarios in Windows desktop applications. It provides both basic file printing capabilities and advanced document generation features with proper pagination support.
Features
Core Printing Services
- File Printing: Print text files with customizable fonts and formatting
- PDF Generation: Create and print PDF documents from text content
- DataGrid Printing: Advanced printing of WPF DataGrid controls with pagination
- ListView Printing: Support for ListView controls with GridView layouts
Document Pagination
- Smart Pagination: Automatic page breaking for large datasets
- Customizable Layouts: Configurable page sizes, margins, and orientations
- Style Management: Consistent styling across printed documents
- Header/Footer Support: Professional document headers and footers
Platform Support
- Windows Only: Optimized for Windows desktop applications
- WPF Integration: Native WPF control support
- Modern .NET: Built on .NET 9.0 with latest C# features
Dependencies
- CG.Infrastructure.Core (v3.10.7) - Core infrastructure components
- CG.Infrastructure.Services (v3.10.2) - Service layer abstractions
- Spire.PDF (v11.7.16) - PDF generation and manipulation
Key Components
IPrintingService Interface
public interface IPrintingService : IService
{
void PrintFile(string path);
void PrintPdf(string? path);
void PrintDataGrid(DataGrid? dataGrid, bool bA4, string? title);
}
PrintingService Implementation
- Handles file and PDF printing operations
- Integrates with logging and document services
- Provides error handling and validation
- Supports both synchronous and asynchronous operations
DataGridDocumentPaginator
- Advanced pagination for DataGrid controls
- Automatic column and row measurement
- Customizable styling and layout options
- Support for alternating row styles and headers
Usage Examples
Basic File Printing
var printingService = serviceProvider.GetService<IPrintingService>();
printingService.PrintFile("path/to/document.txt");
PDF Generation and Printing
var printingService = serviceProvider.GetService<IPrintingService>();
printingService.PrintPdf("path/to/document.pdf");
DataGrid Printing
var printingService = serviceProvider.GetService<IPrintingService>();
printingService.PrintDataGrid(myDataGrid, true, "Sales Report");
Configuration
The library integrates with the .NET dependency injection container and can be configured through standard service registration:
services.AddScoped<IPrintingService, PrintingService>();
Requirements
- .NET 9.0 or later
- Windows operating system
- WPF framework support
- Access to printing devices and drivers
License
This project is part of the CG Infrastructure Libraries and follows the same licensing terms as the parent project.
Contributing
Please refer to the main project documentation for contribution guidelines and coding standards.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0-windows7.0 is compatible. net10.0-windows was computed. |
-
net9.0-windows7.0
- CG.Infrastructure.Core (>= 3.10.7)
- CG.Infrastructure.Services (>= 3.10.2)
- Spire.PDF (>= 11.7.16)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.