如何优雅的将pdf转换成图片
public static List<File> pdf2PngByAspose(File sourceFile, File destDir) {
List<File> resultFiles = new ArrayList<>();
String path = sourceFile.getPath();
if (FileUtil.isPdf(sourceFile)) {
try {
//先把文件缓冲避免流被丢失
InputStream inputStream = new BufferedInputStream(new FileInputStream(sourceFile));
PDDocument doc = PDDocument.load(inputStream);
PDFRenderer renderer = new PDFRenderer(doc);
int pageCount = doc.getNumberOfPages();
for (int pageIndex = 1; pageIndex <= pageCount; pageIndex++) {
BufferedImage image = null;
FileOutputStream fops = null;
InputStream byteInputStream = null;
ByteArrayOutputStream bs = null;
ImageOutput