vthrc@brolga.cc.uq.oz.au (Danny Thomas) (02/12/91)
I would like to know the best way(s) to communicate between an application and a PostScript printer. This means both for simply downloading PostScript to print a document, and to interact with the PS interpreter, eg control startup page, query font set, resolution etc. I had a non-exhaustive look in the Usenet Mac Prog Guide, TN91 & IM2 but none seemed to cover the dynamics of interaction nor how to download a PS header file. I guess IUm looking for a good, preferably concise document describing how to use PostScript from a mac I've just started playing with Prograph, the OO visual dataflow environment for the mac, but the problem I've run into is in using the Printing Manager. The following may have a few mistakes cause it is based on memory while the local netnews system wasn't accepting postings. My application has to print 4 labels on each page and I thought it would be easier doing this directly in PostScript which I am more familiar with than QuickDraw. Depending upon your programming skill, native PostScript is also likely to run quite a bit faster than that produced by the LW driver. I defined a set of procedures culminating in one which takes a few strings off the stack and renders a label on the page. This part was easy, as was using pic comments to begin/end PostScript. Using the TextIsPostScript comment seems a lot easier than using a text handle - I couldn't figure out how to get Prograph to append a CR anyway. BTW the application is emitting only PostScript, no QD stuff. The PS header proc set canUt be defined within a page (ie first) unless it is going to be prepended to every one because each close page does a grestore to the state at the beginning of the page erasing those definitions, but I donUt seem to be able to include the PS code in the stuff going to the printer unless it is being RoutputS on an open page. How do you output PS to the Printer Manager so it is placed in the RProc SetS component of a PS file? preferably with the Printer Manager placing it between the proper document structuring comments, or do you have to bypass the Printing Manager? As far as querying with the PS interpreter, IUve written a test page which prints the information I am after and I think it would be easy to channel that the output stream of the PS interpreter but I donUt know to have my mac application accept what is coming back from the LW. A few times in the past IUve done some PS debugging by outputing what looks like an error msg from the LW R[%%Error: ]S and that has been picked up and displayed by TOPS Spool. Any advice/suggestions gratefully accepted Danny Thomas Vision, Touch and Hearing Research Centre University of Queensland.
mandel@vax.anes.tulane.edu (Jeff E Mandel MD MS) (02/14/91)
In article <1991Feb12.101257.23988@brolga.cc.uq.oz.au> vthrc@brolga.cc.uq.oz.au (Danny Thomas) writes: >I would like to know the best way(s) to communicate between an application >and a PostScript printer. > >The PS header proc set can't be defined within a page (ie first) unless it >is going to be prepended to every one because each close page does a >grestore to the state at the beginning of the page erasing those >definitions, but I don't seem to be able to include the PS code in the >stuff going to the printer unless it is being output on an open page. >How do you output PS to the Printer Manager so it is placed in the Proc >Set component of a PS file? preferably with the Printer Manager placing >it between the proper document structuring comments, or do you have to >bypass the Printing Manager? > Here is what you need to know. The LaserWriter driver does do a grestore between pages, and since it does the gave prior to the first page, this is a minor nuisance. There is a work-around, however. The LaserWriter driver will transmit the contents of a PREC resource #103 prior to the gsave (if one is present in the resource heirarchy). The resource is plain text, not length byte, no null byte, just PostScript, straight no chaser. The way I use it is: type 'PREC' { string; }; resource 'PREC' (103) { "/jeffDict 50 dict def jeffDict begin " [useful definitions] "end" }; Note that each line should end with a white space, as Rez will otherwise run lines together. This is not well documented by Apple, but I was able to peice it together from various sources, and it works. I have a HyperCard XCMD that makes use of this which I use for mailing lists. Jeff E Mandel MD MS Asst Professor of Anesthesiology Tulane University School of Medicine New Orleans, LA