问题:pdf转换图片在jpegDevice.process()中卡死,一直转换不出结果
Version:23.5
JDK:11
PDF文件地址(2天有效期):https://share-file-test.tezign.com/test/test/51936e4db2043cdc1e98ed15200074e1.pdf?OSSAccessKeyId=LTAIiH7NZflLSZy3&Expires=1687854694&Signature=orP0ywUIi%2BIyIRNR0P0QirQSXt0%3D
代码:
public static void main(String[] args) {
String filePath = “/Users/Downloads/51936e4db2043cdc1e98ed15200074e1.pdf”;
String outPutPath = “/Users/Downloads/”;
OpenDocumentStream(filePath, outPutPath);
}
public static void OpenDocumentStream(String filePath, String outPutPath) {
String fileName = outPutPath + "out.jpeg";
try (BufferedInputStream in = new BufferedInputStream(new FileInputStream(filePath))) {
Document pdfDocument = new Document(in);
JpegDevice jpegDevice = new JpegDevice(new Resolution(130), 0);
jpegDevice.process(pdfDocument.getPages().get_Item(1), fileName);
} catch (Exception e) {
System.out.println(e.getMessage());
}
}