On Tue Dec 9 08:55:30 2025 +0000, 张顾在 wrote:
I must apologise for the delay in responding to you.This issue arises when attempting to print a multi-page PDF file, as only a single page is printed. Below is my analysis process.
1. Added +psdrv, +spool, +localspl, +enhmetafile logging 2. Confirmed error log `07d8:warn:localspl:fpScheduleJob PrintDocumentOnPrintProcessor failed 0` 3. The core printing process resides within the `hmf_proc` function 4. Both `PSDRV_StartPage` and `PSDRV_EndPage` are invoked when printing two pages 5. During the first print operation, `EMF_SaveDC` and `EMF_RestoreDC` are called; both occur within the `hmf_proc` function 6. The `hmf_proc` function serves as a callback handler for Enhanced Metafile (EMF) records. EMF files (.emf) contain a sequence of Graphics Device Interface (GDI) commands describing image rendering. This function handles different types of EMF records (such as line drawing, filling, text output, bitmap operations, etc.) via an extensive switch statement, converting them into corresponding PostScript driver (PSDRV) calls for output on a PostScript printer. 7. During the second print attempt, `EMF_RestoreDC` was called directly without first invoking `EMF_SaveDC`, causing the second print to fail. 8. The primary error occurred within the function line `if (p->iRelative >= 0 || data->saved_dc_top + p->iRelative < 0){`. Here, `data->saved_dc_top` was `0` and `p->iRelative` was `-1`, both representing valid data. 9. The error stems from the second print attempt improperly utilising `restoredc` without first employing `savedc`, resulting in the second page failing to print correctly. I am most sorry that I cannot provide the entire application experiencing issues (as this is internal software). Should you wish, I shall endeavour to create a problem-demonstrating example. @huw
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/3160#note_125270