Get page count within c# WinForm app

Hello every body,
I have a winform application that shows a crystal report through the WinForm Crystalreportviewer.
Is there a way to get in my c# application the total number of pages generated in the report?
Thank You
Giovanni Perrone

You will want to search the forums for questions like this prior to posting as this was answered about 10 threads down from yours.
Get TotalPageCount or last page number
I have not tried it in CR2008 and C# so let me know how it goes.
Good luck.
Jason

Similar Messages

  • How to get Page Count of pdf in Document library in EventHandler

    Hi,
    How to get Page Count of pdf in Document library once uploaded has been done and i would like to update the page count value in document library column of the corresponding file.
    I should achieve it in Event handler.
    Which even should i use, either ItemAdded or "ItemUpdated "?
    Thanks & Regards
    Poomani Sankaran.

    Hello,
    If you are looking for file download or view count then event handler will not work. You need to enable the analytic report to your site. Once you enable it then you can see the report within a browser or you can also create custom webpart to show count
    of specific file.
    http://blogs.msdn.com/b/ecm/archive/2010/05/03/web-analytics-in-sharepoint-2010-insights-into-reports-and-metrics.aspx
    http://sharepoint.stackexchange.com/questions/34611/count-of-files-under-a-folder-in-a-document-library
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • Report.Services 2008 - get page-count or row-count in the c#-code

    hello
    is it possible to get from the ReportViewer-control / ServerReport the page-count or row-count after the
    reportViewerCheck.ServerReport.Refresh();
    statement ??
    many thanks in advance for any clue & regards
    Michael

    Hi Michael,
    Yes, you can get them. For row count, you can add a parameter to store the row count of your dataset in your report.
    Here are the steps:
    1.     Add 2 datasets in your report, one for report use and the other on is to row count use. For instance:
    DataSet1: SELECT     HumanResources.vEmployee.* FROM         HumanResources.vEmployee
    DataSet2: SELECT     COUNT(*) FROM         HumanResources.vEmployee
    2.     Add a parameter, set the parameter’s default value set to Get Values from a query and select DataSet2.
    Then, in your ASP.NET web application code you can use the following function to get the row count of the report:
    private int GetReportRowCount(ReportViewer report)
                return Convert.ToInt32(report.ServerReport.GetParameters()[0].Values[0].ToString());
    For page count, you can refer to the following code:
    private int GetReportPageCount(ReportViewer report)
                return report.ServerReport.GetTotalPages();
    You may not get the correct row count and page count in after executing Refresh () method, that’s because when you run this method, it will start another thread to refresh the report and the code below Refresh () method will not wait refreshing complete but run it. For instance, you may get the page count as o if you run the following code in the Button event:
    // Click this Button to refresh the ReportViewer1
            protected void btnGetPageCount_Click(object sender, EventArgs e)
                // Refresh the ReportViewer1
                this.ReportViewer1.ServerReport.Refresh();
                // Get ReportViewer1's page count and display in the txtPageCount TextBox
                this.txtPageCount.Text = this.ReportViewer1.ServerReport.GetTotalPages().ToString();
    You can run the refresh in separate events and get page count in another event, such as below code:
            // Click this Button to refresh the ReportViewer1
            protected void btnGetPageCount_Click(object sender, EventArgs e)
                // Refresh the ReportViewer1
                this.ReportViewer1.ServerReport.Refresh();
            // Display the txtPageCount's text to ReportViewer's page count
            protected void btnGetPageCount2_Click(object sender, EventArgs e)
                // Get ReportViewer1's page count and display in the txtPageCount TextBox
                this.txtPageCount.Text = this.ReportViewer1.ServerReport.GetTotalPages().ToString();
    Hope this helps! I would suggest you post a new thread in Visual Studio Report Controls forum if you need more help about using ReportViewer in ASP.NET web application.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • Getting Page Count for a Multi-Page PDF file using Illustrator script?

    Does anyone know how to get the page count of a multi page PDF file?  I know you can then open each page using the PDFFileOptions (pagetoopen).  But I need to know up front how many pages there are to loop thru to open each page and process each page.
    Any Ideas?

    This script i did for photoshop:
    OK so lets do it working on WIN and MAC without any shell script.
    This solution is not the best but its working.
    I used Try catch to solve it.
    Only issue is that you should at least somehow know how many pages you expect in pdf.. this mean if you are working with books or flyers...
    Then set the maxPagesCount to that number.
    I am working with pdfs with max 20pages.. so i start open the 20 then 19 then 18 and when i am success i know the amount of pages.
    Its not the quicker way but its usable.
    var maxPagesCount = 20;
    var actPagesCount = maxPagesCount;
    var opts1 = new PDFOpenOptions();
    opts1.usePageNumber = true;
    opts1.antiAlias = true;
    opts1.bitsPerChannel = BitsPerChannelType.EIGHT;
    opts1.resolution = 10; //it will load faster the test page
    opts1.suppressWarnings = true;
    opts1.cropPage = CropToType.MEDIABOX;
    myFunction = function () {
      try { 
          app.displayDialogs = DialogModes.NO;
          var fileList = openDialog();
          for (i = 0; i < fileList.length; i++) {
            actPagesCount = maxPagesCount;
            getPagesCount(fileList[i],maxPagesCount);
            alert(actPagesCount);
      } catch (exception) { 
        alert(exception);
    getPagesCount = function (checkFile, lastPageID) {
      try {          
        for (var checkPage = lastPageID; checkPage > 0; checkPage--) {
          opts1.page = checkPage;                    
          var docRef = open(checkFile, opts1, false);                  
          docRef.close(SaveOptions.DONOTSAVECHANGES);                  
          actPagesCount = lastPageID;                  
          return;                  
          checkPage=0;                              
      } catch (exception) {
        // Look for next page        
        checkPage--;        
        getPagesCount(checkFile,checkPage);

  • Get Page Count of PDF using Publication Post Processing Plugin

    Hi,
    I am using the publiching functionality of BOXI 3.1 to create a large volume of PDFs.  I have a report that I am publishing using a publication with a post processing plugin applied after distribution.  I need to get the total page count of the pdf and store this value in the database.  Becuase I am already using a post processing plugin after distribution, it would be ideal to extract it there...but I cannot figure out how to get the value at this point. 
    Currently we parse the actual binary pdf file, but I know that Crystal and BOXI know this total page count and some point in the processing cycle.  Does anyone know how to get at the total page count of each pdf/report instance?
    Thanks,
    Kristina

    I would post-process the PDF file as you're doing.
    The total page count isn't metadata - it's something computable from the report instance, that is lost after the PDF is generated.
    Trying to work with that would lead to a more complex workflow - i.e., schedule to report format, open the report instance using a reporting SDK, calculate the total page count, export using the reporting SDK to PDF, add the PDF to the publication artifact and remove the report instance, other steps I may have missed....
    Sincerely,
    Ted Ueda

  • Getting Page count with AppleScript

    Hi Everyone,
    It been a long time since I visited so I hope everyone is well.
    Does anyone know how to get the page count of a document with Applescript. The best I've done is to divide the total number of words by the average amount of words on a page. This isn't perfect but it give me something close. I'm using the following snippets to get the info, which is being used to popular real time statitics about the progress of book four on my website.
    set WordCount to word count
    set ParagraphCount to paragraph count
    set PageCount to round (WordCount / 184)
    set CharacterCount to character count
    Paragraph count doesn't seem to come too close either. I think it just adds up the number of carridge returns in the document.
    Cheers
    Chris
    http://www.thomasstrange.com

    <pre>tell application "Pages"
    tell document 1
    page count
    end tell
    end tell</pre>
    For me, the result matches the actual number of pages.
    As for paragraph count, I assume you want to skip empty paragraphs.
    The obvious "length of paragraph 1" doesn't seem to work, so here's a less than optimal solution:
    <pre>tell application "Pages"
    tell document 1
    tell body text
    set paragraphCount to 0
    repeat with aParagraph in every paragraph
    if length of (contents of aParagraph as text) > 1 then
    set paragraphCount to paragraphCount + 1
    end if
    end repeat
    end tell
    end tell
    end tell
    paragraphCount</pre>
    Titanium PowerBook   Mac OS X (10.4.10)  

  • How to get Pages back as a free app?

    It is really weird and I am frustrated. Pages all of a sudden shows that it is a paid app. I am eligible for the free version of iWork and was using it peacefully. while updating, I deleted pages and now it is showing as a paid app on the App Store.

    1. No. I haven't hidden pages purchase
    2. It is not in the trash bin. I think it is because I deleted it midway while it was being updated. I was also facing problem with the updating. Thats why
    3. I do have a time-machine backup. Searched for the app but Pages is nowhere to be found.
    Here is a screen shot. Pls see that among the apps made by apple, only one shows free and downloaded. Pages and Numbers shows paid.

  • 6310 / 7310 Scanned Page Count?

    We're using the HP6310 and HP7310 All-In-Ones for some of our field personnel and in a couple of cases we're having problems with the ADF rollers and, sometimes, tray breaking down more quickly, we think, than it should.
    I can't find any way to do a scanned page count on either of the machines.  Am I missing something?  And if not, if there is no built-in way to do a scanned page count, is there any sort of software solution that might make it possible (either through HP or some sort of independent software), or a higher-end All-in-One that does provide a scanned page count?

    I am working on a parser that was written several years ago by someone else. The only information that is required is the page count. I am adding new conditions to the pattern searches which rely on regular expressions. I know a text search is not possible if there is no unencrypted page tree to search for. My hope is that there is some way to automate 1)passing the pdf from unix to a windows workstation, 2) opening the pdf and resaving it (thus converting it to a linearized document), and 3) restaging the pdf on unix to be reprocessed (which would successfully find the page count within the "Linearized" object entry/tag.

  • How can I get a total page count of a PDF before placing every page in the PDF?

    Before the [long] spiel, I'm using javascript in InDesign CS3.
    I'd like to create a script that places a multiPage PDF in any number of different impositions. (saddle stitch, 4up signatures, 16up signatures etc.)
    I've easily created a script that iterates through a PDF and places it into a new document as (4,1|2,3), (8,5|6,7) etc, which works for printing in duplex, folding each page in half, and gluing the resulting spines to make a simple thick book (for PDFs with more than, say, 64 pages).
    However, the next step is to re-write the script to create a saddle stitch document (16,1|2,15), (14,3|4,13) ... (10,7|8,9). For this I need to know how many pages there are in the PDF before I start placing the PDF pages, and then making the new document [int((PDFpages+3)/4)] pages long.
    Is there a simple way to get the count of PDFpages without going through a loop and placing the next page from the PDF until the placed page number equals the first page number?
    This way seems wasteful:
    var totPDFPages = 1;
    app.pdfPlacePreferences.pageNumber = totPDFPages;
    myPDFPage = sheetFront.place(File(srcPDF), [0,0])[0];
    var pdfFirstPage = myPDFPage.pdfAttributes.pageNumber;
    while (doneCounting == false) {
    totPDFPages += 1;app.pdfPlacePreferences.pageNumber = totPDFPages;
    myPDFPage = sheetFront.place(File(srcPDF), [0,0])[0];
    if (myPDFPage.pdfAttributes.pageNumber == pdfFirstPage) {
    totPDFPages -=1;
    doneCounting = true;
    alert("PDF has " + totPDFPages + " pages!");exit();
    myPDFPage.remove();
    NB. Javascript above *hasn't* been run, but should look similar once debugged.
    The only thing I've though of to relieve the sheer duplication of placing the PDF twice (once for the count, and once for the imposition), is to create an array of impoPages[counter]=myPDFPage, and then shuffle the pages referenced by the array to the correct sheet and position.
    It'd be much easier to be able to assign pageCount = File(srcPDF).pageCount !!!
    Thanks for any help/tips or even a simple "What are you smoking, man!?"
    Cheers,
    Jezz

    this will get almost all pdf pages count.
    jxswm
    function getPDFPageCount(f){
      if(f.alias){f = f.resolve();}
      if(f == null){return -1;}
      if(f.hidden){f.hidden = false;}
      if(f.readonly){f.readonly = false;}
      f = new File(f.fsName);
      f.encoding = "Binary";
      if(!f.open("r","TEXT","R*ch")){return -1;}
      f.seek(0, 0); var str = f.read(); f.close();
      if(!str){return -1;}
      //f = new File(Folder.temp+"/123.TXT");
      //writeFile(f, str.toSource()); f.execute();
      var ix, _ix, lim, ps;
      ix = str.indexOf("/N ");
      if(ix == -1){
        var src = str.toSource();
        _ix = src.indexOf("<< /Type /Pages /Kids [");
        if(_ix == -1){
          ps = src.match(/<<\/Count (\d+)\/Type\/Pages\/Kids\[/);
          if(ps == null){
            ps = src.match(/obj <<\\n\/Type \/Pages\\n\/Count (\d+)\\n\/Kids \[/);
            if(ps == null){
              ps = src.match(/obj\\n<<\\n\/Type \/Pages\\n\/Kids \[.+\]\\n\/Count (\d+)\\n\//);
              if(ps == null){return -1;}
              lim = parseInt(ps[1]);
              if(isNaN(lim)){return -1;}
              return lim;
            lim = parseInt(ps[1]);
            if(isNaN(lim)){return -1;}
            return lim;
          lim = parseInt(ps[1]);
          if(isNaN(lim)){return -1;}
          return lim;
        ix = src.indexOf("] /Count ", _ix);
        if(ix == -1){return -1;}
        _ix = src.indexOf(">>", ix);
        if(_ix == -1){return -1;}
        lim = parseInt(src.substring(ix+9, _ix));
        if(isNaN(lim)){return -1;}
        return lim;
      _ix = str.indexOf("/T", ix);
      if(_ix == -1){
        ps = str.match(/<<\/Count (\d+)\/Type\/Pages\/Kids\[/);
        if(ps == null){return -1;}
        lim = parseInt(ps[1]);
        if(isNaN(lim)){return -1;}
        return lim;
      lim = parseInt(str.substring(ix+3, _ix));
      if(isNaN(lim)){return -1;}
      return lim;

  • Page Version Count within the selected dates

    Hi,
    We have a folder of name General in our site.
    i have two SharePoint date time controls on the user control.
    Now i need to get the number of page versions within the selected dates.
    I am able to get all the pages under the 'General' folder as below
    SPFolder oGeneralFolder = list.RootFolder.SubFolders["General"];
     DataTable dt = new DataTable();
    dt.Columns.Add("Page Versions Count");
    foreach (SPFile file in oGeneralFolder.Files)
    dr["Page Versions Count"] = ?
    Now i need to get the number of page versions within the selected dates.
    Because i don't see any supporting property in SPFile object to filter the page version according to the date.
    Please share your ideas or thoughts on the same.
    Regards,
    Sudheer
    Thanks & Regards, Sudheer

    Hi Naga,
    Get item of File and do the following
      foreach (SPListItemVersion v in item.Versions)
    if(v.Created > daterange &&v.Created < daterange )
    count++;
    Within the foreach loop, check for specified date range and increase the count if it fine.
    Thanks,
    Vivek
    Please vote or mark your question answered, if my reply helps you

  • I downloaded the new Pages and Numbers through my app store but when I open my old documents, it still tells me my 30 day trial is over. How do I get the computer to automatically recognize the new applications?

    More information: I have a 3 year old MacBook and had been using "Microsoft for Mac" until last week when I took my MacBook in for some upgrades- including the operating system Lion. I have been unable to use the Word, Excel, etc. programs because they are not supported on the new operating system... and I already used my 30 day trial of iWork when we first purchased the computer. I decided to buy Pages and Numbers through the App Store icon. When I open the Pages and Numbers under my Applications, I can get them to work. However, when I open old documents saved on my computer, they go into the 'old' iWork messages of that my trial has expired. How do I get the computer to automatically recognize that I've purchased Pages and Numbers?

    You need to delete the trial & then reinstall from the boxed DVD or the Mac App Store. The files to delete are the iWork ’09 folder from the main HD > Applications; the iWork ’09 folder in HD > Library > Application Support & the individual iWork application plist files found in HD > Users > (your account) > Library > Preferences for each user.
    Yvan Koenig has written an AppleScript that removes the files. You can find it on his box.com account in for_iWork'09 > other_iWork'09 items > uninstall iWork '09.zip.

  • Look at your iphoto 'page'. On the left is a margin running vertically down the page and within that margin are shown your files/folders - e.g 'events', I can't get that margin contents back

    Look at your iphoto 'page'.
    On the left is a margin running vertically down the page and within that margin are shown your files/folders - e.g 'events', 'last 12 months', 'anniversary' etc etc.
    Now visualize the 'page' but WITHOUT the margin and the entries in it. It just disappeared while I was editing photos.
    I've tried all the 'File', 'Edit', 'View', 'Share' 'Window' & 'Help' options, but no success.
    There is no apparent way of calling up onto the screen any photos, folders etc. because I can't get the margin and its contents back onto the iphoto page.
    I've tried restoring the page from my backup, where it is all perfect, but that didn't work.
    Help please!

    Move your cursor to the extreme left hand side of the iPhoto Window until it turns into a '+' and then click and drag right.

  • HT1947 I see 2 apple tvs on my ipad, iphone, and within the remote app. How do I get rid of the "old" one?

    I changed the AirPlay password on my apple tv, and now I see 2 apple tvs on my ipad, iphone, and within the remote app. How do I get rid of the "old" one?

    Can be closed. Problem disapeared on its own!

  • How to get web pages opening within pages?

    Just wondering how this is done or implemented. I visited and
    researcehd several websites a while ago and observed that pages
    were opening in pages instead of loading a new page.
    For example: You go to a web page, the links are all above
    under the page banner or on the side like in a side bar or Nav bar
    and the content are on the right or the middle of the page.
    So when you click on a link the page opens within the same
    page with out a new page loading, just the contents gets replaced
    but the entire page doesn't changed. Is this AJAX? I know you can
    do this with Frames but I dont want to use frames, are there other
    ways to get this accomplished?
    Please explained or reference resources.
    Thanks very much.
    Patrick

    opps.forgot the link:
    http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm
    Sorry
    Jeff
    "Jeff" <[email protected]> wrote in message
    news:fpkbii$on7$[email protected]..
    > yes, there can be problems with frames and iframes, but,
    if your looking
    > for an easy solution its the way to go.
    > AJAX offers another option. You might try looking at
    this article, I
    > believe you can adapt it to do what you want.
    >
    > Jeff
    >
    >
    > "Jeff" <[email protected]> wrote in message
    > news:fpk313$fjf$[email protected]..
    >> <iframe src="
    http://www.domainName.com/whatEverPage.htm"
    width="480"
    >> height="450" scrolling="yes"
    name="content"></iframe>
    >>
    >> Jeff
    >>
    >>
    >>
    >> "Webethics" <[email protected]>
    wrote in message
    >> news:fpjjga$t5c$[email protected]..
    >>> Just wondering how this is done or implemented.
    I visited and researcehd
    >>> several websites a while ago and observed that
    pages were opening in
    >>> pages
    >>> instead of loading a new page.
    >>> For example: You go to a web page, the links are
    all above under the
    >>> page
    >>> banner or on the side like in a side bar or Nav
    bar and the content are
    >>> on the
    >>> right or the middle of the page.
    >>>
    >>> So when you click on a link the page opens
    within the same page with out
    >>> a new
    >>> page loading, just the contents gets replaced
    but the entire page
    >>> doesn't
    >>> changed. Is this AJAX? I know you can do this
    with Frames but I dont
    >>> want to
    >>> use frames, are there other ways to get this
    accomplished?
    >>>
    >>> Please explained or reference resources.
    >>>
    >>> Thanks very much.
    >>>
    >>> Patrick
    >>>
    >>
    >>
    >
    >

  • How do you get word count to print at the end of a document in Pages?

    How do you get word count to print at the end of a document in Pages?

    Pages v5 does not provide a user assignable word count variable. With some AppleScript, and a paste operation from the clipboard, you can have locale punctuated word count in this format: 7,803 — anywhere in your document. The following AppleScript works with Pages '09 v4.3 through Pages v5.5.2 on Yosemite.
    I would suggest that you copy paste the following AppleScript into your [Apple] Script Editor and save it (suggestion) wordcnt.applescript. Then, follow this with an option+Save As… and this time set the File format to Script Bundle, or Application with hidden extension — saved to your Desktop. Provided you have a Pages document open, you are then a double-click from the ability to paste your current word count into Pages.
    Note: If you have Pages word count display enabled, it will automatically count your pasted value as another word which initially may deceive on true word count at the time the script was run.
    AppleScript
    --- copy below this line ---
    property locale : "en_US.UTF-8" -- In Terminal, use the locale command to see yours
    if not ApplicationIsRunning("Pages") then
         display dialog "Pages must be running to use this utility."
         return quit
    end if
    tell application "Pages"
        tell body text of front document
            set wordCnt to count words
            -- Don't want punctuated numbers? Remove the single quote from printf format
            set the clipboard to (do shell script "export LC_ALL=" & locale & "; printf \"%'d\" " & wordCnt)
        end tell
    end tell
    on ApplicationIsRunning(appName)
         tell application "System Events" to set appNameIsRunning to exists (processes where name is appName)
         return appNameIsRunning
    end ApplicationIsRunning

Maybe you are looking for