# PDF Text find and replace

Q: I am now doing text replacement ,I have already read some
advices ,which are given in the former article ,what I have achieved
now is the find ,and got the placeholder of the word ,or text ,but
when I write new element to the box of the text ,the format will
change ,e.g the the font size of the letters , I know it's about the
text matrix ,but I really don't know how to set this properties , can
you give a hint ? or can you give me a sample code ?
Many thanks!!!!!!
-------
A: The size of text on the page is controlled by 3 parameters:

- Font size (this is the value you pass in the call to
ElementBuilder.CreateTextBegin() or similar).
- Scaling component in the text matrix (for example: Matrix2D
(scale_x, 0, 0, scale_y, offset_x, offset_y)).
- Scaling component in the CTM (Current Transformation Matrix).

If text is not rotated etc the font size will be: element.GetGState
().GetFontSize() * element.GetTextMatrix().m_a * element.GetCTM().m_a.

By decreasing the value of scaling components in the text matrix or
the 'font size' or you can decrease the size of the text on the page.

If you are replacing some existing text in PDF with new content you
may want to copy the font size, text matrix, and other graphics state
attributes from the previous text content. This way the new text will
appear to have
the same size as old text.