|
|
|
@ -417,7 +417,7 @@ public class StudyFormFillUtil { |
|
|
|
float y = document.bottom() - 20; |
|
|
|
|
|
|
|
// 在每一页都重新计算,确保位置准确 |
|
|
|
String pageText = signText+ " 第 " + currentPage + " 页 / 共 "; |
|
|
|
String pageText =language.equals("zh")? (signText+ " 第 " + currentPage + " 页 / 共 "):(signText+ " page " + currentPage + " / "); |
|
|
|
BaseFont baseFont = footerFont.getBaseFont(); |
|
|
|
|
|
|
|
// 计算页面文本宽度 |
|
|
|
@ -429,8 +429,8 @@ public class StudyFormFillUtil { |
|
|
|
|
|
|
|
// 计算起始位置 |
|
|
|
float totalTextWidth = pageTextWidth + totalWidth + |
|
|
|
baseFont.getWidthPoint(" 页", footerFont.getSize()); |
|
|
|
float startX = (document.getPageSize().getWidth() - totalTextWidth) / 2; |
|
|
|
baseFont.getWidthPoint(language.equals("zh")? " 页":" page", footerFont.getSize()); |
|
|
|
float startX = (document.getPageSize().getWidth() - totalTextWidth) ; |
|
|
|
|
|
|
|
// 写入当前页信息 |
|
|
|
ColumnText.showTextAligned(cb, Element.ALIGN_LEFT, |
|
|
|
@ -440,8 +440,10 @@ public class StudyFormFillUtil { |
|
|
|
cb.addTemplate(total, startX + pageTextWidth, y); |
|
|
|
|
|
|
|
// 写入"页"字 |
|
|
|
ColumnText.showTextAligned(cb, Element.ALIGN_LEFT, |
|
|
|
new Phrase(" 页", footerFont), startX + pageTextWidth + totalWidth, y, 0); |
|
|
|
if(language.equals("zh")){ |
|
|
|
ColumnText.showTextAligned(cb, Element.ALIGN_LEFT, |
|
|
|
new Phrase(" 页", footerFont), startX + pageTextWidth + totalWidth, y, 0); |
|
|
|
} |
|
|
|
|
|
|
|
// PdfContentByte content = writer.getDirectContentUnder(); // 在水印层添加 |
|
|
|
// |
|
|
|
@ -463,7 +465,7 @@ public class StudyFormFillUtil { |
|
|
|
// 添加页眉文字 |
|
|
|
if (StringUtils.isNoneBlank(headerText)) { |
|
|
|
float pageTextWidth1 = baseFont.getWidthPoint(headerText, footerFont.getSize()); |
|
|
|
float startX1 = (document.getPageSize().getWidth() - pageTextWidth1) / 2; |
|
|
|
float startX1 = (document.getPageSize().getWidth() - pageTextWidth1) ; |
|
|
|
|
|
|
|
PdfContentByte cb2 = writer.getDirectContent(); |
|
|
|
ColumnText.showTextAligned(cb2, Element.ALIGN_LEFT, |
|
|
|
|