Diahon.WinUI.Printing.Wpf
0.2.0-alpha
This is a prerelease version of Diahon.WinUI.Printing.Wpf.
dotnet add package Diahon.WinUI.Printing.Wpf --version 0.2.0-alpha
NuGet\Install-Package Diahon.WinUI.Printing.Wpf -Version 0.2.0-alpha
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="Diahon.WinUI.Printing.Wpf" Version="0.2.0-alpha" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Diahon.WinUI.Printing.Wpf" Version="0.2.0-alpha" />
<PackageReference Include="Diahon.WinUI.Printing.Wpf" />
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 Diahon.WinUI.Printing.Wpf --version 0.2.0-alpha
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Diahon.WinUI.Printing.Wpf, 0.2.0-alpha"
#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.
#addin nuget:?package=Diahon.WinUI.Printing.Wpf&version=0.2.0-alpha&prerelease
#tool nuget:?package=Diahon.WinUI.Printing.Wpf&version=0.2.0-alpha&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Diahon.WinUI.Printing.Wpf
Allows printing of a Wpf IDocumentPaginatorSource
using the modern Windows Print-Dialog / PrintManager
.
Usage
Follow the Uwp Printing Guide but use your WpfPrintDocumentSource
instead of the WinUI PrintDocument
.
Have a look at the WpfPrintingSample for more infos.
Simple WpfPrintDocumentSource
.
WpfPrintDocumentSource printSource = new()
{
OnPaginatorRequired = (options, details) =>
{
return new FlowDocument()
{
Blocks =
{
new Paragraph(new Run("Hello, World!")),
new Paragraph(new Run("Page 2")){
BreakPageBefore=true
}
}
};
}
};
Advanced usage with custom options
WpfPrintDocumentSource printSource = new()
{
OnPaginatorRequired = (options, details) =>
{
return details.Options[DocIndexOption].Value switch
{
"0" => new FlowDocument()
{
Blocks =
{
new Paragraph(new Run("Hello, World!")),
new Paragraph(new Run("Page 2")){
BreakPageBefore=true
}
}
},
"1" => new FlowDocument()
{
Blocks =
{
new Paragraph(new Run("""
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
"""))
}
},
_ => throw new UnreachableException(),
};
}
};
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0-windows10.0.22621 is compatible. net9.0-windows 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.
-
net8.0-windows10.0.22621
- No dependencies.
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 |
---|---|---|
0.2.0-alpha | 107 | 1/28/2025 |
0.1.2-alpha | 229 | 3/28/2024 |
0.1.1-alpha | 76 | 3/6/2024 |