We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Re: Find out Image names and count of images from PDF files?

Hi,

How to find out images name and count of images from all pages in pdf file? Also during image extraction from docx, image format (tiff) is not getting extracted and is stopping the execution. Is there any possible method for extraction of all images from word document?

Hi there,


Thanks for your inquiry. Please share your sample Word document here along with your sample code. We will look into the issue and will guide you accordingly.

Best Regards,

priyadharshini:

Hi,<o:p></o:p>

How to find out images name and count of images from all pages in pdf file?

Hi Priyadharshini,


Thanks for contacting support.

Please visit the following link for required information on how to get Name of Images Embedded in PDF File.

In order to get the total count of images in whole PDF file, you need to iterate through each page of PDF file, get the images count in individual page and in order to get the total count of images, sum the count images in each page. Please try using following code snippet.

[Java]

// Load source PDF file<o:p></o:p>

Document pdfDocument = new Document("c:/pdftest/LiveD.pdf");

// create a variable to maintain total images count

int Total_Images=0;

// Iterate through each page of PDF document

for (int pagecount = 1; pagecount <= pdfDocument.getPages().size(); pagecount++) {

// create a variable to track count of images in each page

int Images_per_page=0;

// Get the all images names from specific page of PDF file

for (int i = 0; i < pdfDocument.getPages().get_Item(pagecount).getResources().getImages().size(); i++) {

// Print the names of image file over console

System.out.println(pdfDocument.getPages().get_Item(pagecount).getResources().getImages().getNames()[i]);

// increase the count keeping track of images in each page

Images_per_page = Images_per_page+1;

}

// update the count of total images in PDF file

Total_Images = Total_Images+Images_per_page;

}

// print total images count in PDF file

System.out.print("Total number of images = "+ Total_Images);