Path: utzoo!utgpu!watserv1!watmath!att!rutgers!sun-barr!apple!well!shiva From: shiva@well.sf.ca.us (Kenneth Porter) Newsgroups: comp.lang.postscript Subject: Re: Centering Encapsulated PS Diagrams... Summary: EPS manipulation algorithm Message-ID: <21248@well.sf.ca.us> Date: 19 Oct 90 18:15:49 GMT References: <2449@ux.acs.umn.edu> Lines: 27 I've written my own filter in C to do this, but it's not quite what you want as it will also rotate the picture to fill the page if it's wider than it is tall. The general idea is to scan the EPS file for a line starting with "%%BoundingBox: llx lly urx ury" where the llx, lly, urx, and ury are the extents of the printed image in points (lower left and upper right). Parse these four numbers, then write a new EPS file with a new BoundingBox calculated from the old one. Put appropriate scale and translate commands at the top to put the image where you want it. In the code below, <> means a number that your filter must calculate. The numbers in the comment must be integers. The others can be floats. You have to calculate the scale factor, , to make the image fit the space you want it in. %!PS-Adobe-1.0 %%BoundingBox: translate % new lower left corner scale % is calculated scale factor <-ollx> <-olly> translate % move original lower left to origin %%BeginDocument: %%EndDocument %%EOF