我发现这段代码可以将文本放在页面上的特定位置。
ColumnText ct = new ColumnText(cb);
Phrase myText = new Phrase("TEST paragraph\nNewline");
ct.SetSimpleColumn(myText, 34, 750, 580, 317, 15, Element.ALIGN_LEFT);
ct.Go();
现在我希望在 forloop 中为一系列文本这样做。我有
columnText ct = new ColumnText(cb)
Phrase myText; int x = 34; int y = 750;
for(int i = 0; i<5; i++){
myText = new Phrase("TEST paragraph\nNewline");
ct.SetSimpleColumn(myText, x, y, 580, 317, 15, Element.ALIGN_LEFT);
ct.Go();
x += 10;
y+= 12;
}
但这给了我一个错误,因为文档无法创建。
请问我该怎么做?