How to find the total number of pages in a pdf file in uipath

Hi all,

How to find the total number of pages in a pdf file in uipath

Thanks in adavnce

1 Like

@maria.josephina Check attached zip file

PdfPageCount.zip (422.1 KB)

8 Likes

Hi @indra,

Thankyou for replying. This actually works. But I have a few queries.

What does this regular expression means ?
Regex.Matches(StrReader.ReadToEnd(),"/Type\s*/Page[^s]")

WHat is the output of StrReader.ReadToEnd() ?

@maria.josephina Regex.Matches(StrReader.ReadToEnd(),"/Type\s*/Page[^s]") this is used to match the page number in pdf

https://www.dotnetperls.com/streamreader-readtoend

@indra One more doubt like ;
Where in the pdf pages we can see a string like /Type\s*/Page[^s] ?

@maria.josephina https://stackoverflow.com/questions/1878939/c-sharp-regular-expression

Thanks @indra.
But I understood that. My question is that : In the pdf file, where do we see this type of string /Type/Page

My question is that : In the pdf file, where do we see this type of string /Type/Page

have you check this.?

Hi maria.josephina !

there is a function called “Get Pages” in uipath 10.0 . You need to put the filepath and the output is a integer with the number of pages

Att.

2 Likes

great solution, well done

I also checked this one, we cannot see the regex patter in pdf, but that streamreader read more than what is mentioned in the pdf.
It also read values we do not see in the pdf. If you open the pdf with notepad, you will notice that
each page of pdf contains the patter(Type Page) .
So if there are 3 pages then each page will have (Type Page), so 3 times.

if you open the pdf with note pad then you can see this string /Type /Page