After some investigation of printing in UWP I've highlighted:
- No native way to print PDF document directly from your app without redirecting this task to Edge or other similar program.
- There is a way to print XAML Elements (Image for example) using PrintDocument.
- There is a native way to render PDF into PNG using PdfDocument class
These three points gives us ability to print a PDF, but we have a problem here:
- After rasterization to PNG the quality of output document is quite poor.
Fortunately, PdfDocument allows you to increase the output resolution during rasterization, but...
- But it is memory consuming (x4 resolution leads to x32 memory consumption)
- But it is time consuming (x4 resolution leads to x7 time consumption)
- Even using x4 resolution of output image the quality is still so far from desired.
So I've created a sample which you can play with https://github.com/VitaliyPusan/UwpPrinting
Microsoft Edge for example can print PDF in pretty good quality and it do it fast and without additional memory consumption, but I have no idea how can I do the same thing.
Does anyone knows a better way to print PDF in UWP?