Reputation: 41
I've thoroughly searched the web for answers to this question; however, most of the answers say something about using showpage. I know that you can use showpage to print multiple pages to the printer but I want to view multiple pages on my computer. I would like to see all of the pages in a program like Evince.
I've heard something about using standard comments to print multiple pages but I don't know how they work.
Any helpful comments will be appreciated. Thanks!
Upvotes: 4
Views: 7510
Reputation: 1561
Each page must end with a showpage (except for EPS files) but some software also requires that the document is commented with what is called the "Document Structuring Conventions". Amongst other things, these comments clearly indicate the isolation of a given page.
It's possible that Evince requires that a PS file be DSC 3.0 compliant for some functions to work. I'm not familiar with Evince but a lot of PS-handling software relies on the DSC 3.0.
%!PS-Adobe-3.0
...Beginning of document including setup, etc.
%%Page: 1 1
%%BeginPageSetup
/pgsave save def
%%IncludeResource: font TimesRoman
%%EndPageSetup
...rest of page 1.
showpage
%%Page: 2 2
%%BeginPageSetup
/pgsave save def
%%IncludeResource: font TimesRoman
%%EndPageSetup
...rest of page 2.
showpage
%%Page: 3 3
etc.
...rest of the document...
%%EOF
You can get the definition of the DSC 3.0 from Adobe (http://partners.adobe.com/public/developer/en/ps/5001.DSC_Spec.pdf).
Upvotes: 3
Reputation: 8598
OK, I was having the same issue. Eventually figured it out. This is not perfect but closer than it was...
%!PS-Adobe-2.0
%%Pages: 2
%%Page: 1 1
newpath
100 100 moveto
400 400 lineto
closepath
5 setlinewidth
stroke
showpage
%%Page: 2 2
newpath
100 400 moveto
400 100 lineto
closepath
10 setlinewidth
stroke
showpage
Without the -Adobe-2.0
and the %%Pages:
and %%Page:
all viewers were only showing the last page. i.e. showpage
was "printing" and discarding the first page. This is now displaying both pages correctly in Document Viewer (Ubuntu) and GhostView (Windows). Adobe Illustrator (windows) is now just showing the first page - so obviously this is not a perfect solution, but a step on the way.
NOTE: The blank line after the header appears to be required. Not sure what's going on here, I've never read any formal postscript documentation.
Upvotes: 8
Reputation: 110466
The showpage procedure in postscript renders up a page, and clears the itnernal state reading the graphics contest to start a new page. Any new drawing statements will be done on the new page.
Without a showpage call, there is actually nothing printed - (although that is different for ".eps" )
If you want to view postscript on the screen, showpage is still the way to assert the end of each "slide" and starting of the next - your application have to handle that. Evince as it is certainly will honor the showpage and pause the rendering there, waiting for user intervention before rendering the next page (or wwhatever it does to render the next page)
You don't say how you are generating the postscript, but simply add a "showpage" call in the places you want a pagebreak.
Upvotes: 2