Easily access and use XPS printers.
PM> Install-Package -Id Contrib.System.Printing.Xps -pre --source https://www.myget.org/F/dittodhole/api/v2
PM> Install-Package -Id Contrib.System.Printing.Xps
using global::Contrib.System.Printing.Xps;
using global::Contrib.System.Printing.Xps.ExtensionMethods;
using global::System.Printing;
using global::System.Windows.Documents;
IDocumentPaginatorSource documentPaginatorSource;
var xpsServer = new XpsServer();
var xpsPrinterDefinitions = xpsServer.GetXpsPrinterDefinitions();
foreach (var xpsPrinterDefinition in xpsPrinterDefinitions)
{
xpsPrinterDefinition.Print(documentPaginatorSource,
printQueue => printQueue.DefaultPrintTicket);
var xpsInputBinDefinitions = xpsServer.GetXpsInputBinDefinitions(xpsPrinterDefinition);
foreach (var xpsInputBinDefinition in xpsInputBinDefinitions)
{
xpsPrinterDefinition.Print(documentPaginatorSource,
printQueue => printQueue.ApplyXpsInputBinDefinition(printQueue.DefaultPrintTicket,
xpsInputBinDefinition));
}
}
> git clone https://github.com/dittodhole/dotnet-Contrib.System.Printing.Xps.git
> cd dotnet-Contrib.System.Printing.Xps/
dotnet-Contrib.System.Printing.Xps> cd build
dotnet-Contrib.System.Printing.Xps/build> build.bat
This will create the following artifacts:
artifacts/Contrib.System.Printing.Xps.{version}.nupkg
artifacts/Contrib.System.Printing.Xps.{version}.symbols.nupkg
dotnet-Contrib.System.Printing.Xps is published under WTFNMFPLv3.