Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!news.giganews.com.POSTED!not-for-mail NNTP-Posting-Date: Sun, 24 Mar 2013 09:30:42 -0500 From: John Deubert Organization: Acumen Training Newsgroups: comp.lang.postscript Date: Sun, 24 Mar 2013 07:30:42 -0700 Message-ID: <2013032407304244013-john@acumentrainingcom> References: <514c1f6e$0$21949$426a34cc@news.free.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: translate/rotate combination User-Agent: Unison/2.1.10 Lines: 96 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-GP7qTRyzZ7C7U9Uc6InxdnRW+vFX8oAaeNgJNjXYqT12Rj3b6m3mjxYbAUTv7OoOLNDXsCYWZDgYf+X!cZRvEMHdosMzESwkpMEQ4LvMwh8o6spIzo9hfipBNknN/neqh2NzUAbNU2U2w3cWDQgwWZdy X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 3893 X-Received-Bytes: 4034 Xref: csiph.com comp.lang.postscript:1338 On 2013-03-22 09:07:58 +0000, Lord K. said: > Hi, I can't handle my combination of translate/rotate in the right way :-( > > I want to "run" several postscript files and print them at various place > on a huge poster. > > I would like to define a function with parameters being: > > meaning: go to (x,y) on the page, and rotate the TOP-LEFT edge of the > content of around this (x,y) location with an angle of . > > Bounding box of is well-known and is the same for all files to be > used: 200x2834.64 > > Here is my code: > > > /mypart { > gsave > translate > rotate 0 -2834.64 translate > save > /showpage {} def > /setpagedevice /pop load def > 0 0 translate > 1 1 scale > exch run %(BBox of file is 200 x 2834.64) > restore > grestore > } bind def > (part_1.ps) 90 500 0 mypart > (part_2.ps) 0 2000 1000 mypart > > > But obviously it doesn't work at all. What is wrong? Regards. How does your procedure fail? Does it provoke an error or simply produce no pages (or wrong pages)? There are a few other points to consider: - You do a bare-naked save, which is likely to fail in this context. The save operator puts a saveobject on the stack, which is very likely going to be removed by the code that you are executing from the disk. Better is to give the save object a name: /mySave save def ... ... mySave restore - Note that 0 0 translate and 1 1 scale are effectively no-ops. - As a bit more bulletproofing, you should probably clean up the operand and dictionary stacks after each executed file. A reasonable replacement for your procedure might be something like this: /mypart { /oldstate save def % Note this gives us a "free" gsave translate rotate 0 -2834.64 translate /showpage {} def /setpagedevice /pop load def exch run %(BBox of file is 200 x 2834.64) clear % Clear operand stack cleardictstack % Clean up dict stack oldstate restore } bind def (part_1.ps) 90 500 0 mypart (part_2.ps) 0 2000 1000 mypart Incidentally, I think your approach is fundamentally solid. You are doing your translates & rotates correctly, as fare as I can see. By the way, there are a couple of Acumen Journal articles you might find useful: Issue 4, March 2001 - Concatenating PostScript Files Issue 36, Nov 2004 - Using EPS File in Handwritten Code The Journal is free for the downloading at www.acumentraining.com/acumenjournal.html -- ======== John Deubert Acumen Training PostScript & PDF Engineering Classes & Consulting www.acumentraining.com Learn PostScript programming techniques Read the free Acumen Journal www.acumentraining.com/acumenjournal.html