The attached file produces only 1 page of output, but it should produce 2. While /EndPage is set to force printing the final, incomplete (= without showpage) page, it is not called at end of job so this page does not appear in the output. Sometimes, /EndPage has to accomplish non-trivial tasks, like flushing the last sheet of paper for n-up printing, calling pdfmark, etc.
Created attachment 784 [details] Short file to reproduce the problem. Command lines (Windows version): gswin32c -q -dNOPAUSE -dBATCH -sOutputFile=Bug687557.pdf -sDEVICE=pdfwrite -c .setpdfwrite -f Bug687557.ps and gswin32c -q -dNOPAUSE -dBATCH -sOutputFile=Bug687557-%d.jpg -sDEVICE=jpeg Bug687557.ps
The .endpage was not being invoked when GS did the final closedevice. I haven't investigated whether or not this used to work, but the patch makes sure that the .uninstallpagedevice gets interpreted before the final closedevice, so the .endpage gets run. No regression changes result. The patch is: *** src/imain.c 27 Oct 2003 10:45:18 -0000 1.37 --- src/imain.c 20 Jul 2004 05:45:09 -0000 *************** *** 827,832 **** --- 827,837 ---- if (i_ctx_p->pgs != NULL && i_ctx_p->pgs->device != NULL) { gx_device *pdev = i_ctx_p->pgs->device; + /* deactivate the device just before we close it for the last time */ + gs_main_run_string(minst, + ".uninstallpagedevice " + "serverdict /.jobsavelevel get 0 eq {/quit} {/stop} ifelse .systemvar exec", + 0 , &exit_code, &error_object); code = gs_closedevice(pdev); if (code < 0) eprintf2("ERROR %d closing the device. See gs/src/ierrors.h for code explanation.\n", code, i_ctx_p->pgs->device->dname);