🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

diahon.winui.printing.wpf

Package Overview
Dependencies
Maintainers
0
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

diahon.winui.printing.wpf

0.2.0-alpha
NuGet
Version published
Maintainers
0
Created
Source

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(),
        };
    }
};

Keywords

FAQs

Package last updated on 28 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts