0

I have a UWP app in the Window store that prints envelopes. The app before could automatically print to a wide range of envelope sizes, selected by the user. Microsoft however changed its print UWP APIs, so that this ability now only works for a very small number of envelope sizes. I would like to see if I can access win32 APIs for printing as a work around, to get back the flexibility I had before when I was able to print to a wide range of different sized envelopes. In addition, I would like to be able to allow users to define custom sized envelopes they can print to.

The answer given in the following link by Stefan Wick from Microsoft seemed promising. However I'm simply unable to successfully open and run his Visual Studio solution app, PrinterInterop, which supposedly is along the lines I'm looking for. When I try to open the app in VS 2015, VS 2015 notes that the PrinterInterop project within the solution, requires VS to be updated. When I right click on the project in Solution Explorer, and click on Reload Project in the pop-up menu, I see a dialog which reads, "One or more projects are targeting the Windows 10 Fall Creators Update platform which requires a newer version of Visual Studio. Learn how to upgrade to 15.0.25909.2." I cannot figure out how to upgrade my version of VS 2015 to this newer version. I even did a brand new installation of VS 2015 on another computer, and ran into the same problem. I also tried running the app in VS 2017, and I still cannot get the PrinterInterop project within the solution, to successfully load.

How to Silent print from an UWP Application

I would really appreciate it if someone could suggest a solution to my problem. Thank you.

  • I don't know much about envelope sizes but this doesn't look like a small amount to me. [https://learn.microsoft.com/en-us/uwp/api/windows.graphics.printing.printmediasize](https://learn.microsoft.com/en-us/uwp/api/windows.graphics.printing.printmediasize) – Sean O'Neil Nov 29 '17 at 14:05
  • For my sample you need VS 2017 and the Windows 10 Fall Creators Update SDK (version 16299) installed. That's what I used to build the sample. The demo app will run Win10 Anniversary Update and above. Let me know if you still get errors from this sample project. – Stefan Wick MSFT Nov 29 '17 at 14:31
  • Sean O'Neil. I have used what you suggested in my app since it was a Windows 8 store app. However, about a year after Win 10 came out, and I updated my app to a UWP app, Microsoft updated its Win 10 UWP print APIs, in a manner that resulted in only enum envelope sizes that corresponded to paper sizes that could be selected by users in the UWP print dialog, could be printed to automatically. If I used an enum envelope size that didn't correspond to a paper size a user could select from the UWP dialog, the envelope would not print successfully. – P. Douglas Nov 29 '17 at 15:40
  • Below is a link to my app: http://www.douglascomputing.com/dc-envelope-printer-app.html – P. Douglas Nov 29 '17 at 15:46
  • For reference, these are the [Win32 and COM APIs for UWP apps](https://learn.microsoft.com/en-us/uwp/win32-and-com/win32-and-com-for-uwp-apps). The [Print Document Package API](https://msdn.microsoft.com/en-us/library/windows/desktop/hh448418.aspx) is apparently available as an [Extension API for Windows 10 devices](https://learn.microsoft.com/en-us/uwp/win32-and-com/win32-extension-apis). You are going to have to evaluate, whether this is good enough for you. – IInspectable Nov 29 '17 at 18:05

0 Answers0