I was able to print without showing the UI with Win32 API's (but I had to draw the whole UI myself),
You can use PrintWindow I tested on Windows 10, with PW_RENDERFULLCONTENT flag
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi,
I'm working on WinUI3 desktop app in c++. I want to print the current UI (content of an window) to PDF without should any print UI.
I was able to print without showing the UI with Win32 API's (but I had to draw the whole UI myself),
HDC pdfDC = CreateDC(L"WINSPOOL", L"Microsoft Print to PDF", NULL, NULL);
if (StartDoc(pdfDC, &di) > 0) {
StartPage(pdfDC);
// Perform printing operations here
}
But I want print the current UI to PDF without showing Print UI with WinUI3/CppWinrt interfaces. Is it possible to do so? I read about PrintDocument class but I did not find any good examples. I found one example in C# for UWP app but there is was not able to print to PDF without showing the UI. Can you help me with how to print the current UI(Content of Window) to PDF without showing the UI? Thank you.
I was able to print without showing the UI with Win32 API's (but I had to draw the whole UI myself),
You can use PrintWindow I tested on Windows 10, with PW_RENDERFULLCONTENT flag