QTP10.com is a new and completely free website that offers help in all the versions of HP QTP (including latest version 10). More importantly, it offers free code for users of HP QuickTest Professioal. This site helps you in learning the basics of QTP and descriptive/advanced programming in (QTP) on various environments like - .Net, Infragistics, Web, Windows, etc.

Note -
This blog is NOT affiliated with HP / Hewlett-Packard in any way. The data/questions come from various sources and we have our own testing questions. I am just another Software Tester like you.

Reading PDF file using QTP

Share This Post -

Sponsored Links:

Yesterday I receive a query from a reader of this website.

I have report in PDF file and I need to capture and validate data from PDF file. Could you please let me know how to retrieve data from PDF file using QTP 9.5 ?


Well so far, I know two methods to do it:
1. You can use a 3rd party API for that.
2. Other method to use some DOS tools like PSVIEW which can convert PDF image to text.


For third party API:
If you have Acrobat Writer installed you use ArcoExch object to manipulate pdf files.

Function GetPDFPageCount(filename)
Dim pdfFile,Acroapp,pdf
'PDF File preparations
Set Acroapp = CreateObject("AcroExch.App")
Set pdf = CreateObject("AcroExch.PDDoc")
pdf.Open filename,"temp"
Set pdfFile = pdf.GetPDDoc
GetPDFPageCount = pdfFile.GetNumPages
Set pdffile = nothing
Acroapp.Exit
End Function

Other option is, there is a free library for PDF manipulation is available :
http://www.topshareware.com/Quick-PDF-Library-(public-beta)-download-67987.htm

I never used it, but I think it may help you.
Hope it helps.