Delete one page in pdf file

Hi everyone.

I have 3 difficult questions. Pls guide me to do this :slight_smile:

  1. Might UiPath deleted one page in PDF file ? ex: PDF file has 20 pages, I want to delete 2nd page .

  2. I have splited PDF file which has 20 pages into 20 single pdf file… some pdf files can used selector and another could not… I want to use UiPATH to check one by one… if which could not used selector ( it contain picture only ) then will delete out of folder.

Thanks you so much!

1 Like

lets go one by one

for this

well we need ADOBE reader - a licensed version
only then we would be able to delete the page and recreate a new pdf without that page. Not sure but hope so.
for more info on this hope this would help you

then finally for this

–hope we get the file path of each file witha assign activity like this
arr_FilePath = Directory.GetFiles(“yourfolderpath”,“*.pdf”)
where arr_Filepath is a variable of type string array
–now use a for each loop and pass the above variable as input and change the type argument as string in the property panel of for each loop
–inside the loop use a TRY CATCH ACTIVITY where in the TRY block use a START PROCESS activity and pass the file path as item
–now next to this use a GET TEXT activity and try to access a element in one pdf initially and make the selector dynamic with wildcard so that it would be able to access the term if we are able select that as a element else this would throw the exception which would eventually take us to CATCH block where we can have a activity called ADD TO COLLECTIONS where inthe collection property mention as list_filepath which is a system.collections.generic.list(of string) variable with default value as new list(of string) and item property as item and in the type argument as string
–this would add the file path of pdf which is not the one which can be accessed with elements
–so next to this TRY CATCH block use a for each loop and pass the list_filepath variable as input and change thetype argument as string
–inside the loop use DELETE activity and pass the file path as item which would delete the file one by one

thats all you are done
hope this would help you buddy
Cheers @trunghai


Hi Bro @Palaniyappan

Have a nice day!

Sorry for late reply to you.

I will check closely your suggests for these samples.

Thanks you so much for your strong support always. :slight_smile:

1 Like