我正在使用PDFbox合并5个PDF文件。这段代码突然工作正常,我开始遇到一个问题:行尾。
我尝试记录我的代码。我在加载文档时发现它开始引发异常
final String assignmentReportPath = context.lookup(ResourceProperty.reportBundle.getString("FILE_CREATING_DIRECTORY_PATH")).toString()+ownerConfirmationViewPojo.getCanFileNumber()+context.lookup(ResourceProperty.configBundle.getString("FOLDER_SEPARATOR")).toString()+ownerConfirmationViewPojo.getCanFileNumber()+ResourceProperty.reportBundle.getString("SUFFIX_ASSIGNMENT_REPORT_PARAM");
log.info("::OwnerConfirmationViewUtility::mergeFilesForEmail::assignmentReportPath: "+assignmentReportPath);
final String appraiserWorkSheetPath = context.lookup(ResourceProperty.reportBundle.getString("FILE_CREATING_DIRECTORY_PATH")).toString()+ownerConfirmationViewPojo.getCanFileNumber()+context.lookup(ResourceProperty.configBundle.getString("FOLDER_SEPARATOR")).toString()+ownerConfirmationViewPojo.getCanFileNumber()+ResourceProperty.reportBundle.getString("SUFFIX_APPRAISER_WORKSHEET_PARAM");
log.info("::OwnerConfirmationViewUtility::mergeFilesForEmail::appraiserWorkSheetPath: "+appraiserWorkSheetPath);
final String appraiserLogBookPath = context.lookup(ResourceProperty.reportBundle.getString("FILE_CREATING_DIRECTORY_PATH")).toString()+ownerConfirmationViewPojo.getCanFileNumber()+context.lookup(ResourceProperty.configBundle.getString("FOLDER_SEPARATOR")).toString()+ownerConfirmationViewPojo.getCanFileNumber()+ResourceProperty.reportBundle.getString("SUFFIX_APPRAISER_LOG_BOOK_PARAM");
log.info("::OwnerConfirmationViewUtility::mergeFilesForEmail::appraiserLogBookPath: "+appraiserLogBookPath);
final String ownerConfirmReportPath = context.lookup(ResourceProperty.reportBundle.getString("FILE_CREATING_DIRECTORY_PATH")).toString()+ownerConfirmationViewPojo.getCanFileNumber()+context.lookup(ResourceProperty.configBundle.getString("FOLDER_SEPARATOR")).toString()+ownerConfirmationViewPojo.getCanFileNumber()+ResourceProperty.reportBundle.getString("SUFFIX_OWNER_CONFIRMATION_REPORT_PARAM");
log.info("::OwnerConfirmationViewUtility::mergeFilesForEmail::ownerConfirmReportPath: "+ownerConfirmReportPath);
final String originalReportPath = context.lookup(ResourceProperty.reportBundle.getString("FILE_CREATING_DIRECTORY_PATH")).toString()+ownerConfirmationViewPojo.getCanFileNumber()+context.lookup(ResourceProperty.configBundle.getString("FOLDER_SEPARATOR")).toString()+ownerConfirmationViewPojo.getCanFileNumber()+ResourceProperty.reportBundle.getString("SUFFIX_ORIGINAL_ASSIGNMENT");
log.info("::OwnerConfirmationViewUtility::mergeFilesForEmail::originalReportPath: "+originalReportPath);
final File assignmentReportPDFFile = new File(assignmentReportPath);
final PDDocument assignmentReportPDF = PDDocument.load(assignmentReportPDFFile);
final File appraiserWorkSheetPDFFile = new File(appraiserWorkSheetPath);
final PDDocument appraiserWorkSheetPDF = PDDocument.load(appraiserWorkSheetPDFFile);
final File appraiserLogBookPDFFile = new File(appraiserLogBookPath);
final PDDocument appraiserLogBookPDF = PDDocument.load(appraiserLogBookPDFFile);
final File confirmationReportPDFFile = new File(ownerConfirmReportPath);
final PDDocument confirmationReportPDF = PDDocument.load(confirmationReportPDFFile);
final File originalPDFFile = new File(originalReportPath);
final PDDocument originalPDF = PDDocument.load(originalPDFFile);
final PDFMergerUtility PDFmerger = new PDFMergerUtility();
final String destinationFile = context.lookup(ResourceProperty.reportBundle.getString("FILE_CREATING_DIRECTORY_PATH")).toString()+ownerConfirmationViewPojo.getCanFileNumber()+context.lookup(ResourceProperty.configBundle.getString("FOLDER_SEPARATOR")).toString()+ownerConfirmationViewPojo.getCanFileNumber()+".PDF";
PDFmerger.setDestinationFileName(destinationFile);
PDFmerger.addSource(assignmentReportPDFFile);
PDFmerger.addSource(appraiserWorkSheetPDFFile);
PDFmerger.addSource(appraiserLogBookPDFFile);
PDFmerger.addSource(confirmationReportPDFFile);
PDFmerger.addSource(originalPDFFile);
PDFmerger.mergeDocuments(MemoryUsageSetting.setupMainMemoryOnly());
final File finalFile = new File(destinationFile);