【发布时间】:2014-09-12 12:28:43
【问题描述】:
如何在 itextsahrp 中旋转多行文本?
我试过了:
float x = 200;
float y = 100;
PdfContentByte cb = stamper.GetOverContent(i);
ColumnText ct = new ColumnText(cb);
ct.SetSimpleColumn(new Phrase(new Chunk("Test \n new", FontFactory.GetFont(FontFactory.HELVETICA, 18, iTextSharp.text.Font.NORMAL))),
x, reader.GetCropBox(i).Height -( y+400),500+x, y, 10, Element.ALIGN_LEFT | Element.ALIGN_TOP);
ct.Go();
ColumnText.ShowTextAligned(
cb, Element.ALIGN_CENTER,
new Phrase(new Chunk("Test \n new", FontFactory.GetFont(FontFactory.HELVETICA, 18, iTextSharp.text.Font.NORMAL))), x, reader.GetCropBox(i).Height-y, 12);
ct.SetSimpleColumn 显示多重文本,但我如何旋转它?
ColumnText.ShowTextAligned 不显示多行。
【问题讨论】:
-
我在回答您之前的问题时已经对此进行了解释:不要将
ColumnText添加到stamper.GetOverContent(i),而是创建一个Form XObject(使用PdfTemplate对象)。将ColumnText添加到此PdfTemplate并使用AddTemplate()方法将模板添加到stamper.GetOverContent(i),该方法接受参数以旋转模板。
标签: c# itextsharp