Skip to content

Feature: Windows 10/11 Modern Print Dialog Support#1925

Open
jcarvalho-ptech wants to merge 2 commits into
DavBfr:masterfrom
ptech:windows-modern-dialog
Open

Feature: Windows 10/11 Modern Print Dialog Support#1925
jcarvalho-ptech wants to merge 2 commits into
DavBfr:masterfrom
ptech:windows-modern-dialog

Conversation

@jcarvalho-ptech

Copy link
Copy Markdown
Contributor

🚀 Feature: Windows 10/11 Modern Print Dialog Support (PrintDlgEx)

Overview
Currently, the printing package uses the legacy PrintDlg API on Windows, which opens the old Windows 95-style print dialog. This PR adds support for PrintDlgEx, allowing developers to opt-in to the modern Windows print UI.

Key Changes:

  • New Parameter: Added a windowsModernDialog boolean parameter (defaults to false) to layoutPdf and directPrintPdf.
  • PrintDlgEx Integration: When windowsModernDialog is true, the native Windows implementation now calls the modern PrintDlgEx API instead of the legacy PrintDlg.
  • Memory Leak Fix: Fixed a pre-existing memory leak in the classic dialog's cancel path where ClosePrinter() was incorrectly used instead of GlobalFree() on the DEVMODE handle. The modern cancel path also properly frees native resources and correctly completes the Dart future with false.

Behavior by OS Version:

  • Windows 10: Opens the modern tabbed dialog.
  • Windows 11 (22H2+): Opens the completely redesigned, simplified Windows 11 system print dialog. Note: Microsoft's new dialog unconditionally disables preview for Win32 apps (showing "This app doesn't support print preview") and ignores IPrintDialogCallback, but printing functionality works perfectly.

@jcarvalho-ptech jcarvalho-ptech marked this pull request as ready for review March 25, 2026 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant