mirror of
https://gitee.com/kekingcn/file-online-preview.git
synced 2025-08-20 00:44:35 +08:00
feat(): 可以配置pdf转图片最大页数
This commit is contained in:
parent
2230cfa52b
commit
b6bed9930f
@ -110,6 +110,8 @@ convertMedias = ${KK_CONVERTMEDIAS:avi,mov,wmv,mkv,3gp,rm}
|
||||
#PDF预览模块设置
|
||||
#配置PDF文件生成图片的像素大小,dpi 越高,图片质量越清晰,同时也会消耗更多的计算资源。
|
||||
pdf2jpg.dpi = ${KK_PDF2JPG_DPI:144}
|
||||
# 配置PDF文件生成图片的最大页数
|
||||
pdf2jpg.maxPageSize = ${KK_PDF2JPG_MAXPAGESIZE:1000000}
|
||||
#PDF转换超时设置 (低于50页) 温馨提示这里数字仅供参考
|
||||
pdf.timeout =${KK_pdf_TIMEOUT:90}
|
||||
#PDF转换超时设置 (高于50小于200页)
|
||||
|
@ -50,6 +50,7 @@ public class ConfigConstants {
|
||||
private static String size;
|
||||
private static String password;
|
||||
private static int pdf2JpgDpi;
|
||||
private static int pdf2JpgMaxPageSize;
|
||||
private static String officeTypeWeb;
|
||||
private static String cadPreviewType;
|
||||
private static Boolean deleteSourceFile;
|
||||
@ -503,6 +504,18 @@ public class ConfigConstants {
|
||||
ConfigConstants.pdf2JpgDpi = pdf2JpgDpi;
|
||||
}
|
||||
|
||||
public static int getPdf2JpgMaxPageSize() {
|
||||
return pdf2JpgMaxPageSize;
|
||||
}
|
||||
|
||||
@Value("${pdf2jpg.maxPageSize:1000000}")
|
||||
public void pdf2JpgMaxPageSize(int pdf2JpgMaxPageSize) {
|
||||
setPdf2JpgMaxPageSize(pdf2JpgMaxPageSize);
|
||||
}
|
||||
public static void setPdf2JpgMaxPageSize(int pdf2JpgMaxPageSize) {
|
||||
ConfigConstants.pdf2JpgMaxPageSize = pdf2JpgMaxPageSize;
|
||||
}
|
||||
|
||||
public static String getOfficeTypeWeb() {
|
||||
return officeTypeWeb;
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ public class FileHandlerService implements InitializingBean {
|
||||
try {
|
||||
doc = Loader.loadPDF(pdfFile, filePassword);
|
||||
doc.setResourceCache(new NotResourceCache());
|
||||
pageCount[0] = doc.getNumberOfPages();
|
||||
pageCount[0] = Math.min(doc.getNumberOfPages(), ConfigConstants.getPdf2JpgMaxPageSize());
|
||||
} catch (IOException e) {
|
||||
Throwable[] throwableArray = ExceptionUtils.getThrowables(e);
|
||||
for (Throwable throwable : throwableArray) {
|
||||
|
Loading…
Reference in New Issue
Block a user