For Programmers: Free Programming Magazines  


Home > Archive > PostScript > February 2006 > extracting coordinates from a PS file









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author extracting coordinates from a PS file
Yves-Alain.Nicollet@bull.net

2006-02-10, 7:57 am

Hi.
Can someone help me get the absolute coordinates from the PS file:
ftp://129.184.9.54/pub/yan/insgetstart_pdftops.ps
and explain the method?
Thanks

François Robert

2006-02-10, 6:59 pm

Yves-Alain.Nicollet@bull.net wrote in news:1139573764.751845.296030
@g44g2000cwa.googlegroups.com:

> Can someone help me get the absolute coordinates from the PS file:

Absolute coordinate of what ? Of text ? Of pictures ? Of line art ?

Perhaps if you tell us what root problem you are trying to solve, that
would help understanding whether anybody has already found a solution to
it...
________________________________________
_______________
François Robert
(to mail me, reverse character order in reply address)
Ken Sharp

2006-02-10, 6:59 pm

In article <1139573764.751845.296030@g44g2000cwa.googlegroups.com>,
Yves-Alain.Nicollet@bull.net says...

> Can someone help me get the absolute coordinates from the PS file:
> ftp://129.184.9.54/pub/yan/insgetstart_pdftops.ps
> and explain the method?


'absolute co-ordinates' of what ? The file contains images, text, fonts,
linework. What did you want the co-ordinates of ?


Ken
wizard.fred@gmail.com

2006-02-11, 3:57 am

May be the poster is looking for the currentpoint relative to his
starting page or position on his present page. Showpage would reset
the current page and translate, rotate and scale could move you off the
page when you use other operators. When I first played with postscript
I frequently got lost off of the imaging area. Absolute coordinates
may be meaningless without a reference system. I guess if you wanted
to you could keep track of it. Gsave and grestore usually brings you
back to where you were.
In reference to the sample file. I did a view of the ps file in
GhostView Ghostscript and could only find a small error on page 24, an
AIX overprinting other text.

Yves-Alain.Nicollet@bull.net

2006-02-13, 3:59 am

Sorry. I was out of the office for a few days and did not check this
group.
I see my question was a little inaccurate.
I would like to find out a method to get the absolute coordinates of
all the text that is to be printed, with the origin being at the lower
left corner of the page.
Is it feasible?

Helge Blischke

2006-02-13, 8:04 am

Yves-Alain.Nicollet@bull.net wrote:
>
> Sorry. I was out of the office for a few days and did not check this
> group.
> I see my question was a little inaccurate.
> I would like to find out a method to get the absolute coordinates of
> all the text that is to be printed, with the origin being at the lower
> left corner of the page.
> Is it feasible?


Assuming that you need to get the coordinates in the PS default units (1/72 "),
make the following definitions:

% the following transforms a coordinate pair to the default coordinate system:
/_transform_to_default {matrix currentmatrix transform matrix defaultmatrix itransform} bind def
% then intercept all show operators following this example:
/_sys_show /show load def
/show
{
currentpoint _transform_to_default /string_position exch def
_sys_show
} bind def
% and so on

Keep in mind that in many (if not most) PS jobs text to be printed is splitted into
tiny snippets according to (level 1 compatible) kerning. So you probably need to
keep track of the relative spacing between text snippets (you need to keep the position
at then end of a shown string as well) and treat it as a word boundary only if the vertical
and/or horizontal displacement exceeds certain limits (which usually depend on the
current font size etc). A lot of heuristics will be needed here.

You see, it is not a trievial task, but it is possible.

As a starting point, you may look into and hack the ps2ascii utility that comes
with Ghostscript.

Helge


--
Helge Blischke
Softwareentwicklung
SRZ Berlin | Firmengruppe besscom
http://www.srz.de
Yves-Alain.Nicollet@bull.net

2006-02-13, 7:00 pm

Thank you for your reply. I will try your method asap.

Rod Dorman

2006-02-13, 7:00 pm

In article <1139846846.599618.178310@f14g2000cwb.googlegroups.com>,
<Yves-Alain.Nicollet@bull.net> wrote:
>Thank you for your reply. I will try your method asap.


Keep in mind that there are other text 'showing' commands such as
ashow, awidthshow, widthshow, kshow, cshow, xshow, yshow, xyshow.

--
-- Rod --
rodd(at)polylogics(dot)com
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com