get the total page count in the exported file

hi all,

I am using VS2002 (C#) and CR 8.5, does anyone have any idea on getting the total number of page of the exported file ?

I have a main report and subreport, I am exported as  pdf file after I get the report.
What I want is the total number of page of this pdf file (or we can get from the report).

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You can get the total page count of the crystal reprot but not pdf. That is not possible.
for crystal reprot
there is a total page count function in the special fields of the field explorer. You can drag and drop it into your report and report will show the total count but it wont do it in pdf/
the easiest would be to use the crystal .net object model to obtain the total page count within your application

i would think that there is also an Acrobat sdk to obtain the number of pages of the pdf file, but this seems to be far to complex for this simple purpose.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ultrafishAuthor Commented:
what I mean is to get the total page count inside the C# code during run time.
here is the code I use the get the total page of the report. However it sometimes doesn't work and simply stop the execution of the program. Anyone know what's going on?

int totalPage;
totalPage = rptDoc.FormatEngine.GetLastPageNumber(new CrystalDecisions.Shared.ReportPageRequestContext());
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.