PDF文件与iText - 中心对齐字符串 [英] PDF with iText - Center Align Strings
本文介绍了PDF文件与iText - 中心对齐字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用.NET的iText库来生成PDF。我需要输出带有图像的PDF,其中三个文本字符串位置垂直居中,但绝对Y位置。每个字符串使用不同的字体。我一直在努力寻找一种方法来做到这一点,我可以使用SetSimpleColumn()获得Ok的第一行,但是进一步的尝试没有结果。
I'm using the iText library for .NET to generate a PDF. I need to output a PDF with an image, which has three text strings positions centered vertically, but absolute Y positions. Each string uses a different font. I've been struggling for hours to find a way to do this, I can get the first line on Ok using SetSimpleColumn(), but further attempts have been fruitless.
有没有办法做到这一点?
Is there a way to do this?
推荐答案
我最终得到了这个:
int y_offset = 20;
Phrase fullTitle = new Phrase("Some string", myFont);
ColumnText.ShowTextAligned(cb, Element.ALIGN_CENTER, fullTitle, center, y_offset, 0);
这篇关于PDF文件与iText - 中心对齐字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文