Browse Source

fix:[模板管理]导出

master
15881625488@163.com 2 weeks ago
parent
commit
d5cd777738
1 changed files with 8 additions and 6 deletions
  1. +8
    -6
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/StudyFormFillUtil.java

+ 8
- 6
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/utils/StudyFormFillUtil.java View File

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

Loading…
Cancel
Save