I am getting a pdf in byte array
. I want to convert just the 1st page of the pdf into image
.
I have tired the classes provided by com
Answering on my own question so that others can be benefited with it. After some research I found it and got the solution.
Have a look at this link.
PDFDocumentReader document = new PDFDocumentReader();
PageDetail pageDetail = new PageDetail("", "", , "");
ResourceDetail det = document.getPageAsImage(pageDetail);
BufferedImage image = ImageIO.read(new ByteArrayInputStream(det.getBytes()));
File file = new File("d:/img2.jpg");
ImageIO.write(image, "jpg", file);