Extract images from PDF

I used the PDFImageWriter class to convert a PDF to an image file (png). Now I want to crop the images (images) from the converted image file. I do not know how to do that? Can someone provide some code for this?

+3
source share
2 answers

Perhaps it will work.

private BufferedImage cropImage ( BufferedImage src , Rectangle rect ) {
  BufferedImage dest = src.getSubimage ( rect.x , rect.y , rect.width , rect.height ) ;
  return dest ; 
}
+1
source

If you are trying to crop the image using Java, then this may answer your question: java image crop

If you are trying to extract images from PDF, this may answer your question: How to extract images from pdf using Java (without using pdfbox)

0
source

All Articles