Planet PDF Forum Archive

Planet PDF ForumWowsers! This is page is old, head to the LIVE Planet PDF Forum. It features more than 10 conferences, covering everything from beginner to in-depth developer and pre-press discussions. If you wish to continue... one & two archive covers 1999-2011 (160,000 pages).

New Forum | Previous | Next | (P-PDF) Beginners

Topic: Keep track of X and Y coordinates for Tm
Conf: (P-PDF) Beginners, Msg: 168732
From: er300905
Date: 2/3/2009 09:42 AM


I am trying to develop a tool (in that will read from a PDF file and store the data into variables for later use.
When reading the file, the tool reads every single command into a temp variable (I.e. BT, cm, Tm, Td, etc). It also reads the numbers preceding each command (i.e. 35.88 54.79 18.48 173.28 re).
The PDFs I'm reading the data from are in table format, and I need to keep this format. Which means that the tool needs to "remember" which values were in the same column and same row.
My idea at first was to make a struct with 3 values: col, row and val. 'Val' was supposed to hold the actual text value, and 'col' & 'row' the X & Y coordinates given prior to each "re." But here's where my problem begins.
Sometimes the PDFs do not have a "re" in between each "BT" and "ET" but instead they have "Tm" "cm" "Td" or "TD."
I have been reading the PDF Reference 1.5 for more info about this but I am very confused.
I understand that as soon as BT starts, it initializes "Tm" to the identity matrix, and therefore I know that anything given to Tm right after BT is straight forward.
0 16.08 -16.08 0 50.2809 129.4394 Tm
means that the X and Y values are 50.2809 and 129.4394

The issue begins when I have more than one "Tm" (or "cm" or "Td" or "TD") between BT and ET.

For example

0 7.92 -7.92 0 47.8809 697.2794 Tm
(Here i know what X and Y are)
0 g
0.0198 Tc
"Some Text" TJ
-85.7576 -1.7576 TD
(What happened to X and Y here?)
-0.0053 Tc
"Some Text" TJ
5.2121 -61.303 TD
(And here?)
0.0104 Tc
0.0051 Tw
"Some Text" TJ
0 10.08 -10.08 0 549.0009 395.8394 Tm
(Now I really lost track of X and Y)

Does anyone know a formula or a way to keep track of X and Y every time?

Please help me, I have been struggling with this for over a week now and I'm very frustrated.


PDF In-Depth Free Product Trials Ubiquitous PDF

Debenu Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link...

Download free demo

Debenu PDF Tools Pro

It's simple to use and will let you preview and edit PDF files, it's a Windows application that makes...

Download free demo

Five visions of a PDF Day

In the world of PDFs or as we like to say Planet (of) PDF, a year isn't a real PDF year without an intense few days of industry knowledge sharing.

May 15, 2018
Platinum Sponsor

Search Planet PDF
more searching options...
Planet PDF Newsletter
Most Popular Articles
Featured Product

Debenu PDF Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link control. Take Acrobat to the next level.


Adding a PDF Stamp Comment

OK, so you want to stamp your document. Maybe you need to give reviewers some advice about the document's status or sensitivity. This tip from author Ted Padova demonstrates how to add stamps with the Stamp Tool along with related comments.