Article View: adobe.postscript.programming
Article #201Re: obtain current position for BoundingBox
From: Helge Blischke
Date: Sat, 14 Mar 2009 14:11
Date: Sat, 14 Mar 2009 14:11
30 lines
1978 bytes
1978 bytes
Daniel_Barna@adobeforums.com wrote:
> Hi,
> the bbox device of ghostscript is said to be incorrect (by the manual of
> ps2eps - Linux), and I also experience this: it prints incorrect bounding
> boxes. So I would like to implement an automatic method to obtain the
> correct bounding box, by 1) making a block in the postscript file that I
> generate, like this: /CalculateBBox where { lower_left_x lower_left_y
> moveto currentpoint = = upper_right_x upper_right_y moveto
> currentpoint = = } if
> 2) running gs by defining CalculateBBox: gs -dCalculateBBox myfile.ps;
> and grepping the numbers from the output
>
> The problem is, that currentpoint seems to return the current position in
> a local coordinate system (for example if my eps file is included in a
> latex document, and I want to obtain the bounding box of this final
> document, it fails). Does anybody know how to do this?
>
> Thanks
bracket your BBox computaions with
gsave
matrix defaultmatrix setmatrix
% your stuff here
grestore
in order to get your coordinates in the default coordinate system.
Helge
Technical Details
Message-ID:
<721s71Fmin7oU1@mid.individual.net>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.glorb.com!feeder.erje.net!news.unit0.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mailReferences:
<59b8333c.-1@webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: 10c61a,b287a5a9bad56b X-Google-Attributes: gid10c61a,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.glorb.com!feeder.erje.net!news.unit0.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Helge Blischke <h.blischke@acm.org> Newsgroups: adobe.postscript.programming Subject: Re: obtain current position for BoundingBox Followup-To: adobe.postscript.programming Date: Sat, 14 Mar 2009 15:11:07 +0100 Lines: 31 Message-ID: <721s71Fmin7oU1@mid.individual.net> References: <59b8333c.-1@webcrossing.la2eafNXanI> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit X-Trace: individual.net dG1SGdaBfrViPyeZQaDZuA0Yyrfbiis/rZ+f0Kkd3yMPZl6nc1 Cancel-Lock: sha1:pJv8uCxZx8c6id3T/FhEuXwygiU= User-Agent: KNode/0.99.01