get the total page count in the exported file

Posted on 2004-11-17
Last Modified: 2008-02-01
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).

Question by:ultrafish
    LVL 10

    Expert Comment

    You can get the total page count of the crystal reprot but not pdf. That is not possible.
    LVL 10

    Expert Comment

    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/
    LVL 13

    Accepted Solution

    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.

    Author Comment

    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

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
    There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now