|
|
|
|
@ -24,7 +24,7 @@ public class Pdf2ImgUtil {
|
|
|
|
|
public static List<String> pdfToPic(String fileAddress, String filename, String type, String picPath) throws IOException {
|
|
|
|
|
//long startTime = System.currentTimeMillis();
|
|
|
|
|
// 将文件地址和文件名拼接成路径 注意:线上环境不能使用\\拼接
|
|
|
|
|
File file = new File(fileAddress + "\\" + filename + ".pdf");
|
|
|
|
|
File file = new File(fileAddress + File.separator + filename + ".pdf");
|
|
|
|
|
List<String> picNameList = new ArrayList<>();
|
|
|
|
|
PDDocument doc = null;
|
|
|
|
|
try {
|
|
|
|
|
@ -36,7 +36,7 @@ public class Pdf2ImgUtil {
|
|
|
|
|
// dpi为144,越高越清晰,转换越慢
|
|
|
|
|
BufferedImage image = renderer.renderImageWithDPI(i, 150); // Windows native DPI
|
|
|
|
|
// 将图片写出到该路径下
|
|
|
|
|
ImageIO.write(image, type, new File(picPath + "\\" + "FY_" + filename + "_" + String.format("%04d",i + 1)+ "." + type));
|
|
|
|
|
ImageIO.write(image, type, new File(picPath + File.separator + "FY_" + filename + "_" + String.format("%04d",i + 1)+ "." + type));
|
|
|
|
|
picNameList.add("FY_" + filename + "_" + String.format("%04d",i + 1)+ "." + type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|