Software Testing Social Network

Free Software Testing Tutorial and Quality Assurance Portal

Home Blog navigation How to get number of pages in PDF file?

Welcome to SQAT Blogs!


Aug 10
2009

How to get number of pages in PDF file?

Posted by: Swarup in Testing Tools Blogs

Tagged in: Untagged 

Swarup

I created the following simple VBScript for QuickTest Professional to extract number of pages in PDF file:

' Function GetNumPagesInPDF returns the number of pages in PDF file

' FileName - path to given ODF file

' If a file isn't found, then -1 will be returned

Function GetNumPagesInPDF(FileName)

    Dim oPDFDoc

    Set oPDFDoc = CreateObject( "AcroExch.PDDoc" )

 

    If oPDFDoc.Open( FileName ) Then

        GetNumPagesInPDF = oPDFDoc.GetNumPages()

        Set oPDFDoc = Nothing

    Else

        GetNumPagesInPDF = -1

    End If

End Function


Attention! For US visitors deep discounted electronics products available! CLICK HERE to check it out.
Comments (0)Add Comment

Write comment
You must be logged in to post a comment. Please register if you do not have an account yet.

busy