|
@@ -66,7 +66,7 @@ public class PdfProcessor {
|
|
|
addBackgroundToFirstPage(pdfDoc, backgroundImagePath);
|
|
|
}
|
|
|
// 标题背景样式
|
|
|
- int coverPageCount = modifyHeadings(pdfDoc, tocEntities, coverPage);
|
|
|
+ modifyHeadings(pdfDoc, tocEntities, coverPage);
|
|
|
// 目录
|
|
|
if (tocEntities != null && !tocEntities.isEmpty()) {
|
|
|
generateTableOfContents(pdfDoc, tocEntities, fontPath, coverPage);
|
|
@@ -75,10 +75,7 @@ public class PdfProcessor {
|
|
|
return outputPath;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- private static void updateHeadingPageNumbers(List<TocEntity> headings, List<Integer> deletedPages) {
|
|
|
+ protected static void updateHeadingPageNumbers(List<TocEntity> headings, List<Integer> deletedPages) {
|
|
|
// 确保被删除的页码是升序排列(方便计算)
|
|
|
Collections.sort(deletedPages);
|
|
|
|
|
@@ -98,6 +95,7 @@ public class PdfProcessor {
|
|
|
heading.setPageNumber(originalPage - offset);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
public static String getNewPdfPath(String reportBastPath) {
|
|
|
Path path = Paths.get(reportBastPath);
|
|
|
// 获取文件名和扩展名
|
|
@@ -112,7 +110,7 @@ public class PdfProcessor {
|
|
|
return newPdfPath;
|
|
|
}
|
|
|
|
|
|
- private static List<Integer> removeBlankPages(PdfDocument pdfDoc) {
|
|
|
+ protected static List<Integer> removeBlankPages(PdfDocument pdfDoc) {
|
|
|
int totalPages = pdfDoc.getNumberOfPages();
|
|
|
List<Integer> deletedPages = new ArrayList<>(); // 记录被删除的页
|
|
|
|