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.


#7

Hi Timber,

Thanks for sharing your work!

I’m using the Studio CE, and installed the latest version of PdfSharp.
However, I can’t find any activities on the “activities list”.

Can’t uninstall and reinstall the package.

Could lend a hand on to me?

Check the following screenshots:

BR
Helliton


#8

@Timber
Thank you for your work in the PDF extensions activities! However ,
i too , am not seeing the get page count activity in 2018.2.3


#9

after uninstalling (removing from activities feed and in %localappdata%\uipath\activties)
and reinstalling …
(adding the v1.0.0.13 vaidotas activity and pdfsharp.1.50.4845-rc2a.nupkg to the same activities locations)
… it is now working, thank you!