Thread View: adobe.postscript.programming
2 messages
2 total messages
Started by Daniel_Barna
Fri, 13 Mar 2009 11:34
obtain current position for BoundingBox
Author: Daniel_Barna
Date: Fri, 13 Mar 2009 11:34
Date: Fri, 13 Mar 2009 11:34
15 lines
1394 bytes
1394 bytes
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
Re: obtain current position for BoundingBox
Author: 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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads