Posted 7 April 2025, 10:17 am EST - Updated 7 April 2025, 10:24 am EST
Since the Win11 22H2 update, the call to “C1.Win.C1Preview.C1PreviewPane.Print” shows the new UnifiedPrintDialog that ignores the current PageSetup. E.g. the document in preview is landscape, but the dialog is set to portrait, and the printed document thus has the wrong page setting. Also, the dialog complains that no preview is available.
I created a minimal sample:
PrintDialogTest.zip
It creates a “C1PrintPreviewControl”, which renders a minimal “C1PrintDocument”. The property PageSetup.LandScape is true.
When clicking the print button in the preview control, the Win11 dialog is shown, see screenshot.
I played a bit with the “PrintDialog” (button to the right):
- “PrintDialog.UseEXDialog = false” shows a Win2000 form. Landscape in PageSetup works fine, but it is not the expected result to show a totally outdated dialog.
- “PrintDialog.UseEXDialog = true” results in the current behavior, where the PageSetup is ignored.
Then I found a workaround here to set a registry key:
https://www.vbforums.com/showthread.php?901260-The-modern-print-dialog-issue-after-Windows-11-22H2-update
https://github.com/dotnet/wpf/issues/8355
I could modify this registry key before I handle the click to the print button, and restore it afterwards. But first I wanted to ask here whether you have better suggestions for this?
When previewing a C1FlexReport, we use a “C1.Win.FlexViewer.C1FlexViewerPane”, which seems to fallback to the old dialog in case of Win11 - I found this code snippet while debugging:
printDialog.UseEXDialog = !Win32.IsWin11();
This is also not the best solution, but at least the page setup problem is not obvious to the users.
Best regards
Wolfgang
PS: I noticed this shortly after the release of Win11 22H2, but first thought that it was a Windows bug, as not even Notepad.exe can handle this properly. Then I forgot about this problem, and now first users are updated to Win11 and report this to us ;-).