Results 1 to 6 of 6

Thread: [2.0] I need help on PDF Files ... tnx

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2007
    Posts
    6

    [2.0] I need help on PDF Files ... tnx

    1. How would i know if the type of file is a PDF file?
    2. To determine the number of pages of a PDF File.

    * please use c#

    Thanks in advance ...

  2. #2
    PowerPoster eranga262154's Avatar
    Join Date
    Jun 2006
    Posts
    2,201

    Re: [2.0] I need help on PDF Files ... tnx

    Welcome to the forum.

    Can't we use FileStream method for that. I said that based on Java, not at best in C#. Hope it will work.
    “victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha

  3. #3
    PowerPoster eranga262154's Avatar
    Join Date
    Jun 2006
    Posts
    2,201

    Re: [2.0] I need help on PDF Files ... tnx

    There is a PDFParser class as well. May be it will help you. I found it on MSDN.
    “victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha

  4. #4

    Thread Starter
    New Member
    Join Date
    Apr 2007
    Posts
    6

    Re: [2.0] I need help on PDF Files ... tnx

    Thanks

  5. #5
    Addicted Member
    Join Date
    Mar 2006
    Posts
    235

    Re: [2.0] I need help on PDF Files ... tnx

    The first four charaters of a valid pdf file will should be:

    Code:
    %PDF-

  6. #6
    Registered User RaviIntegra's Avatar
    Join Date
    Mar 2007
    Location
    Pondicherry, India
    Posts
    125

    Re: [2.0] I need help on PDF Files ... tnx

    Code:
    using Acrobat;
    using AFORMAUTLib;
    private void DisplayPDFPageNumber(string FilePath)
            {
                AcroPDDocClass objPages = new AcroPDDocClass();
                objPages.Open(FilePath);
                long TotalPDFPages = objPages.GetNumPages();
                objPages.Close();
                AcroAVDocClass avDoc = new AcroAVDocClass();
                avDoc.Open(FilePath, "Title");
                IAFormApp formApp = new AFormAppClass();
                IFields myFields = (IFields)formApp.Fields;
                firstPageNumber = myFields.ExecuteThisJavascript("event.value=this.getPageLabel(0);");
                long lst = TotalPDFPages - 1;
                lastPageNumber = myFields.ExecuteThisJavascript("event.value=this.getPageLabel('" + lst + "');");
                avDoc.Close(0);            
            }
    This code is used to get the pdf page number.
    You can get the first page number and the last page number.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width