|
|
@@ -3,7 +3,6 @@ package com.uas.report.service.impl;
|
|
|
import java.io.File;
|
|
|
import java.io.FileFilter;
|
|
|
import java.io.FileInputStream;
|
|
|
-import java.io.FileOutputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
import java.io.OutputStream;
|
|
|
@@ -28,9 +27,6 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.lowagie.text.Document;
|
|
|
-import com.lowagie.text.DocumentException;
|
|
|
-import com.lowagie.text.pdf.PdfCopy;
|
|
|
import com.lowagie.text.pdf.PdfReader;
|
|
|
import com.uas.report.SpecialProperties;
|
|
|
import com.uas.report.core.exception.ReportException;
|
|
|
@@ -474,29 +470,6 @@ public class FileServiceImpl implements FileService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public void createPagedPdfFiles(String pdfFileAbsolutePath) {
|
|
|
- try {
|
|
|
- PdfReader pdfReader = new PdfReader(pdfFileAbsolutePath);
|
|
|
- for (int i = 1; i <= pdfReader.getNumberOfPages(); i++) {
|
|
|
- Document document = new Document();
|
|
|
- FileOutputStream fileOutputStream = new FileOutputStream(
|
|
|
- pdfFileAbsolutePath.replace(".pdf", "_" + i + ".pdf"));
|
|
|
- PdfCopy pdfCopy = new PdfCopy(document, fileOutputStream);
|
|
|
- document.open();
|
|
|
- // 原pdf文件的每一页生成新的pdf
|
|
|
- pdfCopy.addPage(pdfCopy.getImportedPage(pdfReader, i));
|
|
|
- pdfCopy.close();
|
|
|
- // 不关闭,生成的pdf无法正常打开
|
|
|
- document.close();
|
|
|
- fileOutputStream.close();
|
|
|
- }
|
|
|
- pdfReader.close();
|
|
|
- } catch (IOException | DocumentException e) {
|
|
|
- throw new ReportException(e).setDetailedMessage(e);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 根据指定路径获取绝对路径,如果isAbsolutePath为真,直接返回指定路径,否则拼接上模板根路径
|
|
|
*
|