我正在打开文档进行以下操作:
total = writer!!.directContent.createTemplate(30f,16f)
onEndPage:
val img = Image.getInstance(total)
img.scaleAbsolute(30f,30f) //tried without it as well
img.setAbsolutePosition(PageSize.A4.width-10,20f)
document.add(img)
ColumnText.showTextAligned(writer.directContent, Element.ALIGN_CENTER, Phrase(document.pageNumber.toString()),document.right(20f), document.bottom(), 0f)
最后打开关闭文件:
ColumnText.showTextAligned(total,Element.ALIGN_LEFT, Phrase(" of "+(writer!!.currentPageNumber-1)),document!!.right(20f), document.bottom(), 0f)
例如,我的页码未显示为“ 10之2”。 我刚得到2、3、4 ...等等