|
|
@ -179,14 +179,11 @@ public class FileHandlerService {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public List<String> pdf2jpg(String pdfFilePath, String pdfName, String baseUrl, FileAttribute fileAttribute) {
|
|
|
|
public List<String> pdf2jpg(String pdfFilePath, String pdfName, String baseUrl, FileAttribute fileAttribute) {
|
|
|
|
List<String> imageUrls = new ArrayList<>();
|
|
|
|
List<String> imageUrls = new ArrayList<>();
|
|
|
|
Integer imageCount ;
|
|
|
|
Integer imageCount = null; ;
|
|
|
|
String imageFileSuffix = ".jpg";
|
|
|
|
String imageFileSuffix = ".jpg";
|
|
|
|
String pdfFolder = pdfName.substring(0, pdfName.length() - 4);
|
|
|
|
String pdfFolder = pdfName.substring(0, pdfName.length() - 4);
|
|
|
|
boolean force_updated_cache=fileAttribute.forceUpdatedCache();
|
|
|
|
boolean forceUpdatedCache=fileAttribute.forceUpdatedCache();
|
|
|
|
String filePassword = fileAttribute.getFilePassword();
|
|
|
|
if (!forceUpdatedCache){
|
|
|
|
if (force_updated_cache){
|
|
|
|
|
|
|
|
imageCount = Integer.valueOf("0");
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
imageCount = this.getConvertedPdfImage(pdfFilePath);
|
|
|
|
imageCount = this.getConvertedPdfImage(pdfFilePath);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String urlPrefix;
|
|
|
|
String urlPrefix;
|
|
|
@ -207,7 +204,7 @@ public class FileHandlerService {
|
|
|
|
if (!pdfFile.exists()) {
|
|
|
|
if (!pdfFile.exists()) {
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
PDDocument doc = PDDocument.load(pdfFile,filePassword);
|
|
|
|
PDDocument doc = PDDocument.load(pdfFile);
|
|
|
|
doc.setResourceCache(new NotResourceCache());
|
|
|
|
doc.setResourceCache(new NotResourceCache());
|
|
|
|
int pageCount = doc.getNumberOfPages();
|
|
|
|
int pageCount = doc.getNumberOfPages();
|
|
|
|
PDFRenderer pdfRenderer = new PDFRenderer(doc);
|
|
|
|
PDFRenderer pdfRenderer = new PDFRenderer(doc);
|
|
|
@ -321,7 +318,7 @@ public class FileHandlerService {
|
|
|
|
if (StringUtils.hasText(fileKey)) {
|
|
|
|
if (StringUtils.hasText(fileKey)) {
|
|
|
|
attribute.setFileKey(fileKey);
|
|
|
|
attribute.setFileKey(fileKey);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (StringUtil.isNotBlank(forceUpdatedCache) && "true".equalsIgnoreCase(forceUpdatedCache)) {
|
|
|
|
if ( "true".equalsIgnoreCase(forceUpdatedCache)) {
|
|
|
|
attribute.setforceUpdatedCache(true);
|
|
|
|
attribute.setforceUpdatedCache(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|