How to get text position in PDF using PHP, TCPDF & FPDI?
I have an issue: I need to upload some PDF template with data and then change it. For example, in PDF file is string:
NAME:开发者_JS百科
I need get position of this string and insert some text (username etc.) after it.
Is it possible ?
Update
The PDF isn't encrypted. Text is embedded as text.
This is not trivial and not possible with 100% reliability inside a PDF file because you may have to re-render the layout (to accommodate for elements moving, lines breaking etc.)
If you need to change some static form fields, you may be able to work with simple search+replace operations. For anything more complex, see e.g. this question of mine for some background and possible solutions: PHP PDF template library with PDF output?
If the PDF isn't encrypted (no master/client password), and the text is embedded as text and not as a rendered image, you can just do some basic string search/replace on it - PDFs are essentially Postscript code, and you can treat that as plain text for the most part.
精彩评论