After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 590084 - print to FILE with multiple pages per sheet has bad results
print to FILE with multiple pages per sheet has bad results
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Printing
2.17.x
Other Linux
: Normal normal
: ---
Assigned To: Evince Maintainers
Evince Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-07-28 22:52 UTC by Nicolò Chieffo
Modified: 2009-08-10 09:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
input.pdf (465.75 KB, application/pdf)
2009-07-30 16:59 UTC, Nicolò Chieffo
  Details
2 pages per side.pdf (53.44 KB, application/pdf)
2009-07-30 17:00 UTC, Nicolò Chieffo
  Details
expected result.pdf (78.95 KB, application/pdf)
2009-07-30 17:01 UTC, Nicolò Chieffo
  Details
wait for page draw finish (1.73 KB, patch)
2009-08-03 14:57 UTC, Marek Kašík
needs-work Details | Review
reworked patch (1.62 KB, patch)
2009-08-07 11:16 UTC, Marek Kašík
committed Details | Review

Description Nicolò Chieffo 2009-07-28 22:52:56 UTC
2.27.4

Try to print using the FILE printer, and save a PDF with multiple pages per sheet enabled (using 2 or 4 always triggers the issue, I didn't try more).

The result file has some empty pages between the normal pages.
Comment 1 Carlos Garcia Campos 2009-07-30 09:54:29 UTC
It's a known issue, thanks for reporting. 

Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find.


*** This bug has been marked as a duplicate of 583429 ***
Comment 2 Nicolò Chieffo 2009-07-30 16:59:24 UTC
Created attachment 139571 [details]
input.pdf
Comment 3 Nicolò Chieffo 2009-07-30 17:00:34 UTC
Created attachment 139572 [details]
2 pages per side.pdf

obtained printing pages 5-8 with the additional option of 2 pages per side
Comment 4 Nicolò Chieffo 2009-07-30 17:01:29 UTC
Created attachment 139574 [details]
expected result.pdf
Comment 5 Nicolò Chieffo 2009-07-30 17:02:15 UTC
No evince function is called during printing, because singe evince 2.27.x with gtk 2.17.x, it will use gtk print operations.
Comment 6 Marek Kašík 2009-08-03 14:57:04 UTC
Created attachment 139791 [details] [review]
wait for page draw finish

Hi,

the problem is that function "end_run" can be executed with wrong page number when printing in another thread, so it can finish drawing of a sheet prematurely. Attached patch fixes this.

Regards

Marek
Comment 7 Matthias Clasen 2009-08-07 03:34:02 UTC
Hmm, I don't like how increment_page_sequence is now called in two places.

Should increment_page_sequence not be called in the one place where we definitively know that the page rendering is done, gtk_print_operation_draw_page_finish ?
Comment 8 Marek Kašík 2009-08-07 11:16:35 UTC
Created attachment 140105 [details] [review]
reworked patch

Hi Matthias,

the problem with gtk_print_operation_draw_page_finish () is that it doesn't have an access to the PrintPagesData structure. So, it cannot pass it to the increment_page_sequence function.
I removed the second call of the increment_page_sequence () function, it is not necessary.

Regards

Marek
Comment 9 Matthias Clasen 2009-08-07 16:26:43 UTC
Might be slightly more elegant to move the -1 -> 0 transition into increment_page_sequence ?

Other than that, looks good to me.
Comment 10 Marek Kašík 2009-08-10 09:42:52 UTC
Hi Matthias,

you are right, I moved the check to the increment_page_sequence() function.

Committed:

    Increment page sequence before print of the page, not after
    
    When printing, increment page sequence before rendering of the page,
    not after (#590084).
    In opposite case it runs "end_page" function with wrong parameters when
    drawing a page in another thread.

Marek