What does setTextMatrix of contentByte class in iT

2019-04-16 10:48发布

问题:

I am using iText and am very new to it. There have been several situations where I think I could have figured out the problem with my code if I knew what I was doing - I use examples without knowing the workings behind the code, and even as I look at the source I can't figure out what the programmer was thinking.

What does setTextMatrix of contentByteArray in iText do? And how do I figure out the parameter values I need?

For example:

cb.setTextMatrix(1, 0);

回答1:

first parameter sets left margin, second parameter sets bottom margin.



回答2:

  1. The input parameters are x,y coordinates in points, unless CTM scaling was defined.
  2. 0,0 would be the bottom left of the template you are referencing.
  3. The position is the 'baseline' of the text, rather than the top or the bottom.

Transcribed from this source: https://sourceforge.net/p/itext/mailman/message/12855218/



标签: pdf itext