Skip to content

Conversation

@Maxime-J
Copy link

@Maxime-J Maxime-J commented Sep 24, 2025

Fixes #3453, fixes #4235, fixes #4779, fixes #4817.

Setting a single page print range in modern UI results in SumatraPDF printing the current page.
It's caused by a change of behavior between legacy and modern print dialog, which, like you identified,
sets flags in a non expected way.

Here are flags hex values in different scenarios:

Single page range (2 or 2-2)
Legacy 0x00040006
Modern 0x00440014 -> Causing the issue because PD_CURRENTPAGE is set.

Other ranges
Legacy 0x00040006
Modern 0x00040016

Current page
Legacy 0x00440004
Not available in modern

All pages
Legacy 0x00040004
Modern 0x00040014

So, modern dialog sets PD_CURRENTPAGE instead of PD_PAGENUMS when a single page range is entered,
lpPageRanges containing the custom range, with nFromPage and nToPage set to the chosen page.

About code, note that nPageRanges == 1 check is added for precaution,
it is always equal to 1 when legacy and modern dialogs set PD_CURRENTPAGE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant