page: handle EPS without showpage

This commit is contained in:
Russ Cox 2019-02-25 09:45:53 -05:00
parent 3ad4afbe82
commit 047fd92174
2 changed files with 6 additions and 1 deletions

View file

@ -186,6 +186,10 @@ spawngs(GSInfo *g, char *safer)
Binit(&g->gsrd, stdoutp[0], OREAD);
gscmd(g, "/PAGEDIDSHOWPAGE false def\n");
gscmd(g, "/showpage { /PAGEDIDSHOWPAGE true def showpage } bind def\n");
gscmd(g, "/PAGEFLUSH { PAGEDIDSHOWPAGE not {showpage} if /PAGEDIDSHOWPAGE false def } def\n");
gscmd(g, "/PAGEOUT (/dev/fd/4) (w) file def\n");
if(!strcmp(safer, "-dSAFER"))
gscmd(g, ".setsafe\n");

View file

@ -353,7 +353,7 @@ Keepreading:
}
if(dumb) {
fprint(ps->gs.gsfd, "(%s) run\n", argv[0]);
fprint(ps->gs.gsfd, "(%s) run PAGEFLUSH\n", argv[0]);
fprint(ps->gs.gsfd, "(/dev/fd/3) (w) file dup (THIS IS NOT A PLAN9 BITMAP 01234567890123456789012345678901234567890123456789\\n) writestring flushfile\n");
}
@ -420,6 +420,7 @@ psdrawpage(Document *d, int page)
* so send one to avoid deadlock.
*/
write(ps->gs.gsfd, "\n", 1);
fprint(ps->gs.gsfd, "\nPAGEFLUSH\n");
im = convert(&ps->gs.g);
if(im == nil) {
fprint(2, "fatal: readimage error %r\n");