Wednesday, June 17, 2009

How to manipulate Adobe Acrobat PDF files usning QTP.

In order to manipulate (open, close etc.) a PDF file from within QTP (QuickTest Professional) you need to have Acrobat installed on your system. I have used Adobe Acrobat Professional 7.0 for the purpose of this post.

Below are few scripts which can get you started in your journey to learn PDF manipulation using QTP. Reading the below scripts carefully and understanding them will help you learn better. For example in the third script below I have shown how to get first 3 words of first page, you can modify this according to your own to get more data etc. I have tried to keep the scripts simple and added more comments for easy understanding.

A script to open, display and close a PDF file using QTP.

A script to Search for a particular text in a PDF file using QTP. (More about Findtext and Wait functions used in this script)

How to get first 3 words of first page of any PDF file using QTP.

How to highlight first word of first page of any PDF file using QTP.

Reading data from PDF and writing to a text file using QTP.

Combining two PDF files into one file using QTP.

How to crop a PDF file using QTP.



Few other good sources to learn more:

Introduction to Acrobat Development

Developing with Inter-Application Communication (IAC)

OLE Automation

Adobe® Acrobat SDK Help