轉jpg範例
PdfDocument pdfDoc = new PdfDocument(pdf_file);
int count = pdfDoc.getPageCount();
int zoom = 1;
for(int i=0;i < count ;i++){
PageRenderer render = new PageRenderer(pdfDoc.getPage((i+1)), zoom, Page.PAGE_ROTATE_AUTO, ImageType.IMAGE_TYPE_RGB);
render.setAntiAliasLevel(8);//需設為8,不然中文字會變醜
render.render(true);
JPGOptions options = new JPGOptions();
options.setQuality(96);
FileOutputStream out = new FileOutputStream(new File(out_dir+(i+1)+".jpg"));
JimiWriter writer = Jimi.createJimiWriter("image/jpeg", out);
writer.setSource(render.getImage().getSource());
writer.setOptions(options);
writer.putImage(out);
out.flush();out.close();
render.dispose();
}
pdfDoc.dispose();