hobbit@topaz.rutgers.edu (*Hobbit*) (08/03/88)
The following is an attempt to print pages in "four-up" mode, four little
frames per real page, with appropriate reduction and such. This is raw
postscript, not something you plug into your favorite text formatter. The
bit Q here is: Why does it fail?! The error comes at the indicated "show",
which wimps out claiming "invalidaccess". Does it have something to do
with redefining showpage? What's with it? The manual tells me nothing about
why "show" would fail this way; usually when I shove a string on the stack,
I can do what I want with it. Replies, if any, to me...
_H*
****************
%!PS-ack
%%% Attempt to print regular pages in 4-up mode.
/realshowpage {showpage} bind def %% hide showpage
% finish it up
%%% Ignore the fact that these borders aren't centered. I didn't get a chance
%%% to fix them up before this other problem came along...
/borders { 0 setlinewidth 20 10 moveto 20 780 lineto 590 780 lineto
590 10 lineto closepath stroke 20 380 moveto 590 380 lineto
290 10 moveto 290 780 lineto stroke } def
% really print the page if done, otherwise move to stored place, skrunch, and
% do the next one. We're really courting disaster by assuming that everything
% under here doesn't leave turds on the stack. This is alleviated somewhat
% by using save/restore instead of gsave/restore...
/showpage { State restore dup 0 eq {clear borders realshowpage}
{ /State save def translate .5 .5 scale
} ifelse } def % new showpage
%% instead of getting fancy, throw all these initial thingies on the
%% stack and pop 'em out as we need to move around the page.
0 0 290 10 20 10 290 380 % other 3 border ll corners
% start doing first one
/State save def 20 380 translate .5 .5 scale
%%% Okay, now we start with a simpleminded example of what I wanted to print
/Times-Bold findfont 12 scalefont setfont
50 650 moveto (Page 1) show showpage
50 250 moveto
%%% the following successfully dumps the stack, rcheck produces "true", and
%%% then you get "invalidaccess" for show. WTF??!!?
(Page 2, fucked up) dup rcheck pstack flush pop show
%%% If you comment out the preceding line, the following works [draws a line
%%% from 50,250 to 0,0 in the second frame, so it's not a problem with having
%%% moved there in the first place. Otherwise it should go from the end of
%%% the string to the current origin.
0 0 lineto stroke
showpage
%%% For the sake of brevity, simulate the end of it all
grestore
borders
realshowpage
%% that's it..
louie@trantor.umd.edu (Louis A. Mamakos) (08/03/88)
I just had this very same problem with a dvi to postscript converter that I hacked up. The problem is that the show for "Page 2" no longer has a current font! Note that you do the setfont, followed by a restore, which zaps your current font. Invalidaccess? Not really as helpfull (as, say, nocurrnetfont or something). This is as weird one. Happend to me the same way; first page works fine, and then.. Louis A. Mamakos WA3YMH Internet: louie@TRANTOR.UMD.EDU University of Maryland, Computer Science Center - Systems Programming
greid@ondine.COM (Glenn Reid) (08/04/88)
>The following is an attempt to print pages in "four-up" mode, four little >frames per real page, with appropriate reduction and such. This is raw >postscript, not something you plug into your favorite text formatter. The >bit Q here is: Why does it fail?! The error comes at the indicated "show", >which wimps out claiming "invalidaccess". Does it have something to do >with redefining showpage? What's with it? The manual tells me nothing about >why "show" would fail this way; usually when I shove a string on the stack, >I can do what I want with it. Replies, if any, to me... When I run your program, I get an "invalidfont", not an "invalidaccess". The reason it fails is simple, actually: your "restore" gets rid of the current font. What you have done boils down to this: save /Times-Roman findfont 12 scalefont setfont restore 0 0 moveto (text) show Remember that "save" and "restore" also save and restore the graphics state, and that includes the current font. There is no current font in the default graphics state, which is what you return to after the "restore". I hope this helps clear up the problem. Glenn Reid Adobe Systems Developer Support
jcb@lfcs.ed.ac.uk (Julian Bradfield) (08/16/88)
In article <Aug.2.19.27.55.1988.17574@topaz.rutgers.edu> hobbit@topaz.rutgers.edu (*Hobbit*) writes: >The following is an attempt to print pages in "four-up" mode, four little >frames per real page, with appropriate reduction and such. This is raw >postscript, not something you plug into your favorite text formatter. The >bit Q here is: Why does it fail?! The error comes at the indicated "show", >which wimps out claiming "invalidaccess". Does it have something to do >with redefining showpage? What's with it? The manual tells me nothing about >why "show" would fail this way; usually when I shove a string on the stack, I don't know whether this is anything to do with your problem, but be warned that (in some environments, at least---in my case, Apple Laserwriter with various DVIPS stuff downloaded) showpage is not an operator, but is a procedure defined in userdict , which calls the showpage operator (found in systemdict ). Since bind doesn't do anything to names that are associated with procedures, if you have this setup, to redefine showpage you need to do something like /realshowpage /showpage load def
bader+@andrew.cmu.edu (Miles Bader) (09/05/88)
louie@trantor.umd.edu (Louis A. Mamakos) writes: > I just had this very same problem with a dvi to postscript converter that I > hacked up. The problem is that the show for "Page 2" no longer has > a current font! > > Note that you do the setfont, followed by a restore, which zaps your current > font. Invalidaccess? Not really as helpfull (as, say, nocurrnetfont or > something). This is as weird one. Happend to me the same way; first page > works fine, and then.. Some print spoolers reverse the pages, and along the way, put a save-restore pair around each one. So if you're following the PS formatting conventions, it's a good idea to treat each page as if there is no state carried over from the previous page. -Miles