【发布时间】:2015-10-30 16:07:29
【问题描述】:
我正在使用 itext 在 Java 中创建一个 PDF 表。我想把它放在右上角。 这是我的代码 sn-p。当我执行下面的代码时,表格在 pdf 的右下角对齐,但我希望它在右上角。
PdfPTable table = new PdfPTable(1);
table.setHorizontalAlignment(Element.ALIGN_RIGHT);
table.setWidthPercentage(160 / 5.23f);
PdfPCell cell = new PdfPCell(new Phrase(" Date" , NORMAL));
cell.setBackgroundColor(BaseColor.BLACK);
cell.setBorderWidth(2f);
table.addCell(cell);
PdfPCell cellTwo = new PdfPCell(new Phrase("10/01/2015"));
cellTwo.setBorderWidth(2f);
table.addCell(cellTwo);
【问题讨论】:
标签: itext