in general i don't think it's possible to do in the easy way we all want to do it. from what i've seen of PDF, the layout is done by the creating application. by this i mean that whereas in Postscript somebody might have:
(This is the Title) centered-bold
a PDF file would have more something like:
x y moveto (This is the Title) show
my code is way off, but the idea is that the application determines the absolute position of the text to show, so even if you can read the PDF and unpack the text strings from whatever format they're in, if you change the text then you change the layout and your PDF is going to be all messed up.
Postscript tends more to having code in the file to handle the layout, and you pass a chunk of text to the code and it get's laid out as the program is run on the printer.so if you change a word in the middle of the paragraph it won't cause the line to run off the edge of the page. the absolute position isn't determined untill run-time.
this is based on looking at a bunch of PDF modules and always seeing things like put_text(x,y,text) which returns how many x's are left in the line. it seems that the PDF creator is responsible for things like wrapping/centering text.
does this make any sense?
In reply to Re: Replacing text in a PDF file
by zengargoyle
in thread Replacing text in a PDF file
by Basilides
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |