I'm trying to extract table data from a PDF. To this end, I need the precise locations of the beginning and end of a piece of text, and that's where my question comes in. For testing, I generated some text using LaTeX. Consider the following minimal example:
\documentclass{article}
\begin{document}
foo
\end{document}
When compiled via latex -> dvips -> ps2pdf, I get (after decompression) the following PDF code, which looks fine:
10 0 0 10 0 0 cm # concat to transformation matrix
BT # begin text mode
/R8 9.96264 Tf # select font
1 0 0 1 148.68 657.24 Tm # set text matrix
[(f)3.87556(o)-29.9875(o)-5.88993]TJ
# ^ print 'f', then go a little bit left, print 'o' (so f and o
# overlap a bit), go a little bit right, print 'o'. Then go right again,
# for whatever reason.
But when using xelatex, it looks like this:
1 0 0 1 72 720 cm # concat a DIFFERENT transformation matrix
0 G 0 g # set gray levels to 0
BT # begin text mode
/F1 9.963 Tf # select font
76.71 -62.76 Td # move to text position (this was missing above)
[(fo)-28(o)]TJ # print 'fo', then go 28 right, then print 'o'
What confuses me is the last line in the second output: How come that 'f' and 'o' overlap? Where is that specified? I don't see any 'Tc' commands or the such. And then how come that the second 'o' doesn't overlap with the first one?
Thanks a lot!




(72,720)to the later shift(76.71,-62.76), you get(148.71,657.24)which is pretty much the same thing so no issues on the trafo matrix. – percusse Aug 5 '12 at 12:49fizz(which should be corrected in both methods and maybe it helps. – percusse Aug 5 '12 at 13:58