Page Number of a PDF document

pdf

#1

i am trying to use
{ sr = new streamreader([path of a pdf]) and matches = regex.Matches(sr.ReadToEnd(),"/Type\s*/Page[^s]") } with { pages = matches.Count.ToString } to find out the total no. of pages of a pdf document.

However, this method may count more pages (e.g. 167 pages but the actual no. is 162 only). Is there any easy way to find the no. of pages of a pdf document??

Thanks a lot !!


#2

http://www.hkexnews.hk/listedco/listconews/SEHK/2018/0625/LTN20180625413.pdf

Above is the link to download the sample pdf. Thanks.


#3

Hello @ivan123, I have added GetPageCount activity to PdfSharp.Activities package so you can easily get the number of pages of PDF.


#4

@Timber Thanksss ! It really helps!


#5

Hello Timber

I installed the PdfSharp Activity. But the activity GetPageCount is not in the package.

second:
i ust the extract PDF Pages Activity but i don 't now what to write into the range part of the Activity. I now “1,2,3,4” but with 50 pages i like to use “All” but that won 't work.
See also my other topic

[quote=“Timber, post:3, topic:54713, full:true”]
Hello @ivan123, I have added GetPageCount activity to PdfSharp.Activities package so you can easily get the number of pages of PDF.

What needs to be the input in Range with the Extract pdf Pages Activity?

Greetings


#6

Hey @nicostegeman, maybe you didn’t installed the latest version? 1.0.0.13 is the one with GetPageCount.

If you have 50 page PDF and want to get 50 PDFs of 1 page each, then use SplitPDF activity and set GroupOf property to 1.