How to find Pdf pages containing images

Hi all,
I want to build BOT who can extract pages containing images from pdf and add to another pdf.
Can you please explain how to recognise image in a page and move page to another file

Hello @Ajeshwari_esai

Welcome to Uipath community !

Can you try the below activity.

@Rahul_Unnikrishnan thanks for the reply
But I want extract whole page not only image

@Ajeshwari_esai

Let me think of some alternatives. There are some options like extracting the enitre pages to different files, then loop through each file and use the Extract Images from PDF activity. After this activity if some jpg files generate then you can move that pdf to some folder( it means it has an image)

@Rahul_Unnikrishnan

Ok I will try this

@ Rahul_Unnikrisgnan
I have looped through each file and now if I use extract image activity,how to recognise jpg image created or not. Any activity is there?

@Rahul_Unnikrishnan
I have looped through each file and now if I use extract image activity,how to recognise the jpg image is there in folder or not.Is there any activity?

@Ajeshwari_esai you need to keep a separate folder for that. If any file present then image is there. Then move the pdf file to some folder and delete the jpg file extracted…

So for each loop it can use the same folders for checking whether image exists and to move the pdf files

@Rahul_Unnikrishnan
That logic work… thank you so much

@Ajeshwari_esai Glad to hear that… :grinning: Please close the thread by marking as solution.

@Rahul_Unnikrishnan
One more question
If current page does not contain any image but previous and next page contains the image then move current page to folder, how it works?

@Ajeshwari_esai

If you find an image you need to directly move that pdf to some other folder.
Also, the image you are keeping, for each iteration you need to clear that image folder.

It means when ever an image found you need to move the pdf and clear the image folder. So if a page with no image, then the logic will not move that pdf file.

@Rahul_Unnikrishnan
That i have done and it’s working
But my question is if I want to print the pages back to back, pages containing images and pages not containing images will print seperately.
And if I want to integrate both as pages are from same pdf, then page nos will not match

E.g If first page contains image, I have to move that page to folder. If 2nd page does not contain image i have to check if last page and next page contains images , if so i have to move the page to the folder otherwise no

@Ajeshwari_esai

Then you have to use the nested if condition.

Already you have the page count variable and you have the variable i for the current page.

i+1 will give the next page count . So if no image exists for the current page, then use the same process for next page and lat page and get the status of image check to 2 other variables(maybe nextPageVar,LastPageVar)
Use a nexted if in the first if. If both variables are true, then move the file.

Better you can draw the flow in a page and create the logic. The above method you can try.

@Rahul_Unnikrishnan
I will try this logic
Thank you