I tried to replace a placeholder in a pdf file. After I extracted the text and replaced the placeholder with the desired value, I had to rebuild the file, while preserving all formatting. The problem is I don't understand the algorithm used to obtain the numbers which are between brackets [] and how to create the segments between parantheses () for example:
Before replacing : Tf 1 0 0 1 65.22 695.04 Tm [(Phas)4(ellus tin)6(cid)3(unt,)-2( ju)8(st)-3(o)7( vitae in)6(te)-3(rd)7(um )3(con)3(vallis)5(, augu)5(e null)3(a)4( venenati)7(s odi)3(o, id )5(ornare eros f)6(elis )] TJ ET
I should mention that I use PHP to decompress the PDF and replace text and I must use PHP to reassemble the file afterwards. Also I have read the relevant parts of the PDF referrence but it contains mentions to matrices I have not found and there are no examples to make things clearer.