https://bugs.winehq.org/show_bug.cgi?id=55670
Bug ID: 55670 Summary: Word 2007 and Wordpad are no longer able to print multiple copies of a page Product: Wine Version: 8.16 Hardware: x86-64 OS: Linux Status: NEW Keywords: regression Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: dmitry@baikal.ru CC: piotr@codeweavers.com Distribution: ---
This problem has been noticed with Word 2007 however it's also possible to reproduce with wordpad ('wine write' is a nice wrapper to run wordpad).
Steps to reproduce: 1. wine write 2. Ctrl+P (File -> Print), it's fine to print empty document 3. Select "Print to file", set "Number of copies" to 2, select Pages 1 - 1 for clarity 4. Press OK, save "output.prn".
When the bug is not present output.prn contains the comment %%cupsJobTicket: copies=2 otherwise this comment is missing from the generated Postscript file.
According to my testing last version of Wine that was able to correctly print multiple copies is wine-7.22, wine-8.0-rc1 is already broken.
It's not really possible to correctly find the offending commit because breakage has side effects like a failure to create "output.prn". If a missing output.prn could be considered as 'bad' during bisection then the regression is caused by $ git bisect bad 017e9557db73a4b51b5cb2eacbf638288b5e6719 is the first bad commit commit 017e9557db73a4b51b5cb2eacbf638288b5e6719 Author: Piotr Caban piotr@codeweavers.com Date: Fri Dec 2 21:23:50 2022 +0100
localspl: Use print processor in ScheduleJob.
Wine with this commit reverted writes correct "output.prn" with %%cupsJobTicket: copies=2, however using Wine with that commit leads to a missing "output.prn".
P.S. wine-8.0 is not able to print to a file (missing "output.prn") wine-8.0.2 is able to create "output.prn" however %%cupsJobTicket: copies=2 is missing As a result with wine-stable it's impossible to print multiple copies of a page.
I'd personally consider this bug as major, especially when stable Wine release is affected, however I'll leave to Piotr to decide.
https://bugs.winehq.org/show_bug.cgi?id=55670
Piotr Caban piotr.caban@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |piotr.caban@gmail.com
--- Comment #1 from Piotr Caban piotr.caban@gmail.com --- It looks like it will take some work to fix it properly. The EMF spool file format supports storing DEVMODE that contains number of copies but it's ignored on Windows.
Another place that stores DEVMODE is SHD file (we currently don't create the file at all). I guess it stores information about number of copies to print. I will need to do some more testing to confirm.
SHD file format is described here: https://github.com/kacos2000/WinHex_Templates/blob/master/SHD%20spool%20shad... I'm not sure if we need to be binary compatible.
https://bugs.winehq.org/show_bug.cgi?id=55670
--- Comment #2 from Dmitry Timoshkov dmitry@baikal.ru --- (In reply to Piotr Caban from comment #1)
It looks like it will take some work to fix it properly. The EMF spool file format supports storing DEVMODE that contains number of copies but it's ignored on Windows.
Do we really need to be compatibe with Windows and ignore the dmCopies field when interpreting EMF?
Another place that stores DEVMODE is SHD file (we currently don't create the file at all). I guess it stores information about number of copies to print. I will need to do some more testing to confirm.
SHD file format is described here: https://github.com/kacos2000/WinHex_Templates/blob/master/ SHD%20spool%20shadow%20file.tpl I'm not sure if we need to be binary compatible.
Why do we need to follow undocumented Windows internals?
https://bugs.winehq.org/show_bug.cgi?id=55670
--- Comment #3 from Piotr Caban piotr.caban@gmail.com --- (In reply to Dmitry Timoshkov from comment #2)
Do we really need to be compatibe with Windows and ignore the dmCopies field when interpreting EMF?
It's possible to reprint the document using spool file. Such change will affect this scenario. Also EMF spool file is not designed for that so we will need to delay PS file header creation until DEVMODE is read.
It will also not work if we ever add support for native print processors / printer drivers.
Why do we need to follow undocumented Windows internals?
I should have written that I don't think we need to be binary compatible. On the other hand there's nothing bad in it if it's not too hard.
Anyway, this were just some notes, I still need to do more testing.
https://bugs.winehq.org/show_bug.cgi?id=55670
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download, printing
https://bugs.winehq.org/show_bug.cgi?id=55670
--- Comment #4 from Dmitry Timoshkov dmitry@baikal.ru --- (In reply to Piotr Caban from comment #3)
Do we really need to be compatibe with Windows and ignore the dmCopies field when interpreting EMF?
It's possible to reprint the document using spool file. Such change will affect this scenario.
Why should we care about this feature?
Also EMF spool file is not designed for that so we will need to delay PS file header creation until DEVMODE is read.
Does that also mean that other things selected in PrintDlgW() like paper size and resolution are no longer respected?
https://bugs.winehq.org/show_bug.cgi?id=55670
--- Comment #5 from Piotr Caban piotr.caban@gmail.com --- (In reply to Dmitry Timoshkov from comment #4)
Why should we care about this feature?
Because it's a valid use case.
Does that also mean that other things selected in PrintDlgW() like paper size and resolution are no longer respected?
Yes, ps file header is currently written using default printer settings.
I've sent a fix for that: https://gitlab.winehq.org/wine/wine/-/merge_requests/3991
https://bugs.winehq.org/show_bug.cgi?id=55670
--- Comment #6 from Dmitry Timoshkov dmitry@baikal.ru --- (In reply to Piotr Caban from comment #5)
Does that also mean that other things selected in PrintDlgW() like paper size and resolution are no longer respected?
Yes, ps file header is currently written using default printer settings.
I've sent a fix for that: https://gitlab.winehq.org/wine/wine/-/merge_requests/3991
I can confirm that with patch applied the produced Postcript file has number of copies, resolution, paper size and orientation that match the values selected in the Print dialog. Thanks!
Should this bug be targeted for the future 8.0.x stable release?
https://bugs.winehq.org/show_bug.cgi?id=55670
--- Comment #7 from Piotr Caban piotr.caban@gmail.com --- (In reply to Dmitry Timoshkov from comment #6)
Should this bug be targeted for the future 8.0.x stable release?
Yes.
https://bugs.winehq.org/show_bug.cgi?id=55670
Dmitry Timoshkov dmitry@baikal.ru changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |8.0.x CC| |mstefani@winehq.org
--- Comment #8 from Dmitry Timoshkov dmitry@baikal.ru --- (In reply to Piotr Caban from comment #7)
Should this bug be targeted for the future 8.0.x stable release?
Yes.
Adding target milesone tag and Michael to the cc: then.
https://bugs.winehq.org/show_bug.cgi?id=55670
Piotr Caban piotr.caban@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Fixed by SHA1| |b4b39bfbd1ac160bc7d7899ae99 | |76bc45902b523 Resolution|--- |FIXED
--- Comment #9 from Piotr Caban piotr.caban@gmail.com --- Marking as fixed.
https://bugs.winehq.org/show_bug.cgi?id=55670
--- Comment #10 from Dmitry Timoshkov dmitry@baikal.ru --- (In reply to Piotr Caban from comment #9)
Marking as fixed.
Confirming that printing from wordpad correctly produces the specified number of copies. Thanks Piotr.
Unfortunately printing from Word 2007 is still broken. Piotr, how would you like to proceed: reopen this bug report and continue the investigation for Word, or open a separate bug report for that?
https://bugs.winehq.org/show_bug.cgi?id=55670
Dmitry Timoshkov dmitry@baikal.ru changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|Word 2007 and Wordpad are |Wordpad is no longer able |no longer able to print |to print multiple copies of |multiple copies of a page |a page
--- Comment #11 from Dmitry Timoshkov dmitry@baikal.ru --- (In reply to Dmitry Timoshkov from comment #10)
Unfortunately printing from Word 2007 is still broken. Piotr, how would you like to proceed: reopen this bug report and continue the investigation for Word, or open a separate bug report for that?
According to my testing printing with specified number of copies from Word 2007 is a different regression. I'll rename this bug report to mention only Wordpad.
https://bugs.winehq.org/show_bug.cgi?id=55670
--- Comment #12 from Dmitry Timoshkov dmitry@baikal.ru --- (In reply to Piotr Caban from comment #1)
It looks like it will take some work to fix it properly. The EMF spool file format supports storing DEVMODE that contains number of copies but it's ignored on Windows.
The problem in Word 2007 is caused by EMRI_DEVMODE record (which contains correct dmCopies) being written at the end of the spool file, and as a result is processed too late.
Piotr, do you need a new bug report for this?
https://bugs.winehq.org/show_bug.cgi?id=55670
--- Comment #13 from Piotr Caban piotr.caban@gmail.com --- Yes, please create a new bug and add me to CC.
https://bugs.winehq.org/show_bug.cgi?id=55670
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #14 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 8.18.