HariPrasad kasavajjala
HariPrasad kasavajjala

Reputation: 340

UWP to print without Print preview

In my UWP application, I wanted to print a document without showing the print UI. Normally we use PrintManager.ShowPrintUIAsync()
But I wanted to print without showing the UI. In my Research, I found that there's no such thing in UWP to print directly without showing Preview. But it can be done through FullTrustProces Launcher (or) Brokered Component. I am unaware of both of this 2 processes. Can someone tell me the way to use them in detail or any other way to get print without showing the Preview or sending stream directly to the Printer?

Edit1: Someone tageed it as a duplicate, so i explained the difference between the 2 questions. It's not the duplicate of that question. My question clearly asks which process shall i use whether the FullTrustProcess Launcher or Brokered Component. The question that person tagged is asking whether there's a way to print silently. But my question is which method is best.

Upvotes: 3

Views: 1085

Answers (1)

Xie Steven
Xie Steven

Reputation: 8621

No matter FullTrustProces Launcher (or) Brokered Component technology, they all call win32 APIs to achieve the silent print.

For the FullTrustProces Launcher, it actually is putting a win32 process in your UWP app package. The win32 process could be console application, Windows Forms app etc. Stefan has replied a similar thread. On that thread, Stefan has explained and provided a simple code sample, please check it.

You could also refer to this blog Desktop Bridge – The Migrate phase: invoking a Win32 process from a UWP app for more details.

For the Brokered Windows Runtime Components, it makes side-loaded Universal Windows Platform apps to interoperate with desktop processes outside of the app container possible. Please see Brokered Windows Runtime Components for a side-loaded UWP app for more details.

Upvotes: 2

Related Questions