How To Check if String Exists in PDF File?

Hello @prasath17 , I will just confirm in excel sheet that this string exists

@GersonTun , Any limitation on number of pages ?

@hsendel - Please take a look at this post…this will help you…Here I have look for a string and if that string exist I will remove that page…You ignore that portion and use the others…

Only thing you have to do here is, instead of hardcoded text you have to pass your datatable row…thats it…

1 Like

Thanks @prasath17 , I will check and revert back to you.

@prasath17 , This is exactly what I want, but is it possible to add a way to show in which pages this needed string exists after Match Activity?

@hsendel - yes very simple…

Index + 1 is the page # you are reading. So when you get hit just print the index + 1…thats all


never go for OCR unless you don’t have a choice

Check this post please…

1 Like

Awsome !!! @prasath17 , Possible to add the number of occurrences of searched string?

@hsendel …yes possible.

In the above post I am looking for word certificate using regex Right…you can use the same logic with some tweak as below…

 IntCount = system.text.regularexpressions.regex.matches(yourstring,regex pattern).count

Great JOB @prasath17 . Topic can be Closed :+1:

1 Like

Hello @prasath17 , Finally not able to get the Total number of occurrences, seems something is missing, Could you please advice ?


Note : I have removed “Solution” Improvement just to avoid closing the Topic, will do it again latter on.

@hsendel - where you are giving this ? Please show me your assign activity…?


If you using this in an assign statement…Please try as shown below…


Note: In your case, Just remove the .value…

1 Like

Thanks @prasath17 , I’ll check and revert back to you.

Hello @prasath17 , I’m not able to include this item in For Each Loop Activity.
Could you please help to add it in your shared Example :
In pdf Get the string avilable page number in to excel - Help / Robot - UiPath Community Forum

@hsendel - please show me what you have tried so far ? My 2nd screenshot is from that Workflow if you look closely.

Please provide couple of screenshors of your assign statements.

Hello @prasath17 , I have added ToString before Count String in RegEx formula, Error disappears but not able to print the corresponding value.

How to keep only one value instead of printing same value “5” each time ?

Is it the wrrong place where I put this IntOccCount ?

@hsendel - you have to put that within if statement under then condition…so that it will print only when there is a match…

You are reading each page and text is searched on each page…so you get total occurrences on each page.

In the given example…Certificate was found in page 1 and page 5…so if you place your assign statement under then condition it will print only 2 times when there is a match.

Please see below, it printed only 2 times when there is a match…and the word certificated had 2 occurrences on each page(verified)

1 Like

YES @prasath17 , Thanks a lot for those details , I really appreciate how you’re providing hints and solutions :+1:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.