Printing on Windows 11 does not honor portrait/landscape flag. (Issue #24130)

1,354 views
Skip to first unread message

David Connet

unread,
Dec 11, 2023, 6:29:44 PM12/11/23
to wx-...@googlegroups.com, Subscribed

wxWidgets 3.2.4 and trunk

Before invoking the Print dialog, I set the orientation to Landscape. In Windows 10, this works properly. In Windows 11, the print dialog still shows the orientation as Portrait.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24130@github.com>

David Connet

unread,
Dec 11, 2023, 7:03:12 PM12/11/23
to wx-...@googlegroups.com, Subscribed

Forgot to mention (actually, I just checked!), this can also be seen in the printing sample on Win11.

  • Page Setup: Change to landscape
  • Print preview: Displays properly
  • Click Printer icon in preview: Windows dialog now has Portrait


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24130/1851089527@github.com>

David Connet

unread,
Dec 12, 2023, 11:06:27 AM12/12/23
to wx-...@googlegroups.com, Subscribed

Note: If the legacy print dialog is restored, printing works as expected.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24130/1852340073@github.com>

David Connet

unread,
Dec 12, 2023, 11:09:34 AM12/12/23
to wx-...@googlegroups.com, Subscribed

With some more googling, it actually looks like this is a Win11 bug. Others are reporting the same issue in pure .Net applications.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24130/1852346020@github.com>

dsa-t

unread,
Nov 3, 2024, 4:28:15 AM11/3/24
to wx-...@googlegroups.com, Subscribed

It might be possible to force the old dialog on Win11, see https://learn.microsoft.com/en-us/answers/questions/1330355/how-to-programmatically-force-use-of-the-old-print

Helg,

I know it's a little late for you, but I recently had to correct the same problem. The "modern" print dialog has the big empty No Preview Available space that looks like the user is missing something.

To get the older print dialog I used the PrintDlg function (instead of PrintDlgEx) that uses the PRINTDLG structure and not the PRINTDLGEX structure. I added the PD_ENABLEPRINTHOOK flag to the flags and created a dummy print hook function:

UINT_PTR __stdcall DummyPrintHookProc (HWND unnamedParam1, UINT unnamedParam2, WPARAM unnamedParam3, LPARAM unnamedParam4) { return 0; }

and put .lpfnPrintHook = &DummyPrintHookProc; to make sure the function is noticed.

Adding the printer hook procedure prevented windows from using the new dialog, but just for that call. It did not change the settings for any other programs or any other call of the print dialog.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24130/2453357858@github.com>

VZ

unread,
Nov 3, 2024, 9:26:13 AM11/3/24
to wx-...@googlegroups.com, Subscribed

Another comment says that it's enough to set hwndOwner to 0 to prevent the use of the new dialog, which is even simpler. We should probably do this, but the question is whether we should do it unconditionally or only when non-default orientation is requested?


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24130/2453446700@github.com>

David Connet

unread,
Nov 6, 2024, 2:21:54 PM11/6/24
to wx-...@googlegroups.com, Subscribed

That might be weird to the user when they select a program option and suddenly the print dialog radically changes. (I have a port/land default setting in my program)


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24130/2460589053@github.com>

Reply all
Reply to author
Forward
0 new messages