[API Proposal]: Print without PrintQueue
abstraction using the modern print dialog
#8940
Labels
API suggestion
Early API idea and discussion, it is NOT ready for implementation
Background and motivation
AFAIK there's currently no solution to print without a
PrintQueue
in case an application already has an instance ofIXpsDocumentPackageTarget
.This scenario occurs when implementing the WinRT
PrintManager
(The modern print dialog) for a WPF app.See PrintCompat.cs and WpfPrintDocumentSource.cs for context.
API Proposal
See XpsSerializationHelper.il for a minimal code flow.
New class
XpsSerializationManagerInterop
Internally expose
IXpsOMPackageWriter
fromXpsOMPackagingPolicy
wpf/src/Microsoft.DotNet.Wpf/src/ReachFramework/Serialization/manager/XpsOMPackagingPolicy.cs
Lines 68 to 72 in 7b755d2
namespace System.Windows.Xps.Packaging { internal class XpsOMPackagingPolicy : BasePackagingPolicy { ... + public IXpsOMPackageWriter XpsOMPackageWriter => _currentFixedDocumentSequenceWriter; ... private IXpsOMPackageWriter _currentFixedDocumentSequenceWriter; } }
API Usage
Alternative Designs
Create an alternative interop
PrintQueue
implementation:This has less new public api surface (only one new method
CreateFromXpsOMPackageWriter
) but might require a lot more internal api changes / abstractions.Risks
Both solutions can likely only be used for a single print, as the
IXpsOMPackageWriter
has to be closed to flush the buffered data to the printer.The text was updated successfully, but these errors were encountered: