Java ですべての PDF ページを単一の画像に
変換する 以下の方法で試しました。PDFBoxを使用しています
PDDocument document = PDDocument.loadNonSeq(file,null);
List<PDPage> pages = document.getDocumentCatalog().getAllPages();
int i =0;
for ( PDPage page : pages ) {
BufferedImage image = page.convertToImage();
BufferedImage imageBW = new BufferedImage(image.getWidth(),
image.getHeight(), BufferedImage.TYPE_3BYTE_BGR);
Graphics g = imageBW.getGraphics();
g.drawImage(image, 0, 0, null);
g.dispose();
java.io.File file1 = new
java.io.File(("D:\\FTPUploads\\GuestSupply_"+i+".jpg"));
ImageIO.write(imageBW, "jpg", file1);
i++;
}
But there difference found is only 10 KB and here it created into 2 images (pdf having 2 pages) i need it in single image. Could you please help me out on this.