PDF 转图片
@Test
public void testPdf2Image1() throws IOException {
File file = new File("/Users/rick/jkxyx205/tmp/fileupload/pdf/1.pdf");
FileMeta fileMeta = FileMetaUtils.parse(file);
List<byte[]> list = FileConvertUtils.pdf2Image(fileMeta.getData(), 150);
File folder = new File("/Users/rick/jkxyx205/tmp/fileupload/pdf");
for (int i = 0; i < list.size(); i++) {
FileUtils.writeByteArrayToFile(new File(folder, i + ".png"), list.get(i));
}
}
@Test
public void testPdf2Image2() throws IOException {
File file = new File("/Users/rick/jkxyx205/tmp/fileupload/pdf/1.pdf");
FileMeta fileMeta = FileMetaUtils.parse(file);
FileConvertUtils.pdf2Image(fileMeta.getData(),
new FileOutputStream("/Users/rick/jkxyx205/tmp/fileupload/pdf/full.png"),
150);
}