Skip to main content
Participant
June 24, 2025
Question

Coordinates calculation in an EPS file

  • June 24, 2025
  • 1 reply
  • 85 views

Hello,

 

I have a question about an EPS file from which I want to read information.

This file contains the following:

...

%%BoundingBox: 13 29 259 113

...

/bg { 1 -1 scale 13 -113 translate 0.7 0.7 scale } def

/cvtx { gsave 1 -1 scale } def

/rstx { grestore } def

/m { moveto } def

gsave
bg

6 88 m
cvtx
(MyText) show
rstx

 

My question now is, where are the coordinates located? If I convert the EPS to PDF, for example, this point (6 88) is at 4.2 22.4 (/MediaBox [0 0 246 84]), since in PDF the y-axis goes from top to bottom, it would be at 4.2 61.6. Unfortunately, I don't understand how to get to this point by calculation.

 

According to the spec, you multiply the matrices to arrive at a new CTM:

newCTM = transformation × originalCTM

However, if I do this and apply it to 6 88, I arrive at a negative y coordinate.

1 -1 scale 13 -113 translate 0.7 0.7 scale => [0.7 0 0 -0.7 13 -113]  with 6 88 => 4.2 -174.6

 

Could someone please tell me where my mistake lies?

Many thanks and best regards

1 reply

9_3_NAuthor
Participant
June 24, 2025

Edit:
I had a small mistake in the post above:

1 -1 scale 13 -113 translate 0.7 0.7 scale => [0.7 0 0 -0.7 13 -113]  with 6 88 => 4.2 17.2 -174.6