iText的定位文本绝对 [英] itext positioning text absolutely
本文介绍了iText的定位文本绝对的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在iText的我有一大块/短语/段(我不介意这些),我想要放置一些别的地方的网页,例如在300×200。我将如何做到这一点?
In itext I have a chunk/phrase/paragraph (I dont mind which) and I want to position some where else on the page e.g. at 300 x 200. How would I do this?
推荐答案
在最后,我写我自己的方法来做到这一点。
In the end I wrote my own method to do it.
private void PlaceChunck(String text, int x, int y) {
PdfContentByte cb = writer.DirectContent;
BaseFont bf = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
cb.SaveState();
cb.BeginText();
cb.MoveText(x, y);
cb.SetFontAndSize(bf, 12);
cb.ShowText(text);
cb.EndText();
cb.RestoreState();
}
这篇关于iText的定位文本绝对的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文