Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!decwrl!adobe!greid From: greid@adobe.com (Glenn Reid) Newsgroups: comp.lang.postscript Subject: Re: BeginSetup/EndSetup Message-ID: <835@adobe.UUCP> Date: 17 May 89 16:28:04 GMT References: <3780@imagen.UUCP> Sender: news@adobe.COM Reply-To: greid@adobe.COM (Glenn Reid) Organization: Adobe Systems Incorporated, Mountain View Lines: 95 The attributions are a little mixed up. The following code segment was the one originally posted by Tomas Rokicki, not by Glenn Reid. In any case, I'll address the question. The caution that Geof Cooper provides in this message is a good one. That is why it is important to follow the structuring conventions correctly, not just to put the comments into the file. In article <3780@imagen.UUCP> geof@apolling (Geof Cooper) writes: >In article <825@adobe.UUCP> greid@adobe.COM (Glenn Reid) writes: >>In article rokicki@polya.Stanford.EDU (Tomas G. Rokicki) writes: >>>%!PS-Adobe-2.0... >>>... >>>%%BeginSetup >>>% we possibly change the CTM here, maybe even stash it away >>>% for later use >>>6 array currentmatrix print flush % this is the *last* thing in setup >>>%%EndSetup >>>%%Page 1 1 >>>6 array currentmatrix print flush % this is the *first* thing in page >>>%%Trailer >>> > >I need to ask another question... were you thinking of storing your >preamble in the printer using exitserver, then just sending the >document part later? If so, what you specify is a bit dangerous, since >the conditions under which the document might print might have a >different matrix from when the preamble was executed. This would be >the case on some printers if the paper tray changed. It would also be >the case on some products if the printing resolution changed between >PostScript files. > >- Geof Cooper > IMAGEN (is a subset of QMS) The "preamble" or "prologue" does NOT include the setup section. That is the point of the BeginSetup / EndSetup comments. They follow the %%EndProlog comment, which is the correct place to break the file if you are going to download the prologue permanently. The Setup section is simply guaranteed to precede the pages, but it is not part of the prologue. Here again is the crux of what I said before, just so we can stay un-confused in our cross-referencing (I've added comments to show where the document can be cut: %!PS-Adobe-2.1 %%BeginProcSet % You can make any definitions you want here, but cannot % change the state of the interpreter. This is the "prologue", % which can be permanently downloaded or made available once % for a large number of individual document bodies. %%EndProcSet %%EndProlog % ------------- cut here for permanent download of the prologue ---------- %%BeginSetup % You can change the state of the interpreter here, and % provide any job-specific setup like reencoding fonts. % Bear in mind that YOU are responsible for any state % you set here and how it is used by each page. The % structuring conventions just guarantee that it will % always be executed first, before any of the pages. The % structuring conventions to not dictate *which* page % will be the one to execute after setup. It could be % page 1, page 4, or page 15, depending on page selection % and reordering that may be done by the server. This section % is part of the individual document body, and must be % repeated with each document. It is not part of the prologue. %%EndSetup % ------------- cut here for page reordering or subsetting --------------- %%Page: "label" m % any code can go here. It may rely on prologue definitions % made before the %%EndProlog comment, and it may rely on % state set up in the Setup section ONLY IF it also leaves % that state set at the end of the page. This is because % the pages must not be interdependent, and any of them may % be executed in any order. % If a matrix representing the current matrix is stored into % a variable during setup, it is reasonable to use this value % with "setmatrix" to establish the coordinate system at the % beginning of each page. %%Page: "label" n % This is exactly the same as page "m" %%Trailer % The structuring conventions guarantee only that this code % will be executed last, after the final page. It is % appropriate here to remove your dictionaries from the % dictionary stack and to make sure you've left nothing % on the operand stack. %%EOF % If this is the end of job and an end-of-file would normally % appear here, this comment may be used to indicate end-of- % file in a transport-mechanism-independent manner. Glenn Reid Adobe Systems