Recently I faced with a question:
How to get number of pages in PDF file?
In other words, how to get number of pages for any given PDF file, like on this image:
This is QuickTest Professional 9.5 User's Guide, located in
Let's see how we can get this number from QTP script.
I created the following simple VBScript for QuickTest Professional to extract number of pages in PDF file:
I call GetNumPagesInPDF function with a full path of PDF file:
And the result of this QTP script is:
It provides an interface for common Acrobat document opeartions, such as: opening/closing, working with pages etc.
To use "AcroExch.PDDoc" object, you have to install Adobe Acrobat (do not confuse with Acrobat Reader!) on your computer.
You can check whether "AcroExch.PDDoc" object is available on your computer. For that, open a registry and check the path:
If "AcroExch.PDDoc" key exists, then you can use Acrobat OLE Automation in your QTP scripts.
If not, then Adobe Acrobat should be installed.
The above code can work without QuickTest Professional!
Just save the code into vbs-file and run. It will return the same result - number of pages in PDF file.
- How to minimize/maximize QTP window before the QTP script execution
- How to record QTP script - VIDEO tutorial
- How to get current iteration number of QTP script?
- How to get text of status bar from QTP?
- QTP VIDEO - How to capture dynamic text
- QTP Descriptive programming - processing images
- All QTP visual tutorials
Do you have interesting topics and ideas to be explained and shown on this blog?
Please, let me know! Send them to my email: