|
@@ -654,7 +654,7 @@ public class PrintCommonServiceImpl implements PrintCommonService {
|
|
htmlFileTemp = SystemConstant.getFileTempVar(SystemConstant.HTML_PREFIX);
|
|
htmlFileTemp = SystemConstant.getFileTempVar(SystemConstant.HTML_PREFIX);
|
|
FileCopyUtils.copy(htmlContent.getBytes(StandardCharsets.UTF_8), htmlFileTemp);
|
|
FileCopyUtils.copy(htmlContent.getBytes(StandardCharsets.UTF_8), htmlFileTemp);
|
|
|
|
|
|
- return saveAttachmentPdfFromHtml(fileName, htmlFileTemp, userId, localFileList, fileTempList);
|
|
|
|
|
|
+ return saveAttachmentPdfFromHtml(fileName, htmlFileTemp, userId, localFileList, fileTempList, PageSizeEnum.A3);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
log.error(SystemConstant.LOG_ERROR, e);
|
|
log.error(SystemConstant.LOG_ERROR, e);
|
|
basicAttachmentService.deleteAttachment(basicAttachment);
|
|
basicAttachmentService.deleteAttachment(basicAttachment);
|
|
@@ -673,14 +673,14 @@ public class PrintCommonServiceImpl implements PrintCommonService {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@Transactional
|
|
@Transactional
|
|
- public BasicAttachment saveAttachmentPdfFromHtml(String fileName, File file, Long userId, List<PdfDto> localFileList, List<File> fileTempList) {
|
|
|
|
|
|
+ public BasicAttachment saveAttachmentPdfFromHtml(String fileName, File file, Long userId, List<PdfDto> localFileList, List<File> fileTempList, PageSizeEnum pageSizeEnum) {
|
|
BasicAttachment basicAttachment = null;
|
|
BasicAttachment basicAttachment = null;
|
|
File pdfFileTemp = null;
|
|
File pdfFileTemp = null;
|
|
try {
|
|
try {
|
|
|
|
|
|
pdfFileTemp = SystemConstant.getFileTempVar(SystemConstant.PDF_PREFIX);
|
|
pdfFileTemp = SystemConstant.getFileTempVar(SystemConstant.PDF_PREFIX);
|
|
// html转pdf
|
|
// html转pdf
|
|
- HtmlToPdfUtil.convert(file.getPath(), pdfFileTemp.getPath(), PageSizeEnum.A3);
|
|
|
|
|
|
+ HtmlToPdfUtil.convert(file.getPath(), pdfFileTemp.getPath(), pageSizeEnum);
|
|
|
|
|
|
//pdf上传
|
|
//pdf上传
|
|
String pdfDirName = SystemConstant.getNanoId() + SystemConstant.PDF_PREFIX;
|
|
String pdfDirName = SystemConstant.getNanoId() + SystemConstant.PDF_PREFIX;
|
|
@@ -688,7 +688,7 @@ public class PrintCommonServiceImpl implements PrintCommonService {
|
|
|
|
|
|
PdfDto pdfDto = PdfUtil.addPdfPage(pdfFileTemp);
|
|
PdfDto pdfDto = PdfUtil.addPdfPage(pdfFileTemp);
|
|
if (localFileList != null) {
|
|
if (localFileList != null) {
|
|
- localFileList.add(new PdfDto(pdfFileTemp.getPath(), PageSizeEnum.A3, pdfDto.getPageCount()));
|
|
|
|
|
|
+ localFileList.add(new PdfDto(pdfFileTemp.getPath(), pageSizeEnum, pdfDto.getPageCount()));
|
|
}
|
|
}
|
|
basicAttachment = new BasicAttachment(JSON.toJSONString(filePathVo), fileName, SystemConstant.PDF_PREFIX, new BigDecimal(file.length()), filePathVo.getMd5(), userId);
|
|
basicAttachment = new BasicAttachment(JSON.toJSONString(filePathVo), fileName, SystemConstant.PDF_PREFIX, new BigDecimal(file.length()), filePathVo.getMd5(), userId);
|
|
basicAttachment.setPages(pdfDto.getActualPageCount());
|
|
basicAttachment.setPages(pdfDto.getActualPageCount());
|