Android
ComPDFKit PDF SDK
Guides

Extract Image

 

To extract images from a PDF document, use function CPDFPage.extractImages(String filePath).

Extracting images from a page is time-consuming, and you are advised to perform this operation asynchronously.

The code below will grab all images from the first page of the given PDF document:

File folder = new File(imageFolder);
if(!folder.exists()){
   folder.mkdir();
}
CPDFPage pdfPage = readerView.getPDFDocument().pageAtIndex(0);
try {
   pdfPage.extractImages(folder.getCanonicalPath());
} catch (IOException e) {
   e.printStackTrace();
}