Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 452
  • Last Modified:

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).

  • 2
1 Solution
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.
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());

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now