Reading PDF file using QTP

Share This Post -
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.