How to compare 2 excel files using QTP?
How to compare 2 PDF files using QTP?



How to compare 2 excel files using QTP? How to compare 2 PDF files using QTP?..

Answer / srihari j

How to compare 2 PDF files using QTP?

Dim varPath1, varPath2, str1, str2
varPath1 = "C:first.pdf"
varPath2 = "C:second.pdf"

str1= getPDFText (varPath1)
str2= getPDFText (varPath2)

if StrComp(str1,str2,0) <> 0 Then
msgbox "PDF files do not have same text content"
else
msgbox "PDF files have same text content"
end If

Public Function getPDFText (varPath)

Dim MyClipboard

SystemUtil.Run varPath

Window("regexpwndtitle:=Adobe Reader","regexpwndclass:=AdobeAcrobat").Type micAltDwn + "t" + micAltUp

Window("regexpwndtitle:=Adobe Reader","regexpwndclass:=AdobeAcrobat").Type "s"

Window("regexpwndtitle:=Adobe Reader","regexpwndclass:=AdobeAcrobat").Type micDwn

Window("regexpwndtitle:=Adobe Reader","regexpwndclass:=AdobeAcrobat").Type "Enter"

Window("regexpwndtitle:=Adobe Reader","regexpwndclass:=AdobeAcrobat").Type micCtrlDwn + "a" + micCtrlUp

Window("regexpwndtitle:=Adobe Reader","regexpwndclass:=AdobeAcrobat").Type micCtrlDwn + "c" + micCtrlUp

Set MyClipboard = CreateObject("Mercury.Clipboard")

getPDFText = MyClipboard.GetText

MyClipboard.Clear

Set MyClipboard=Nothing

Window("regexpwndtitle:=Adobe Reader","regexpwndclass:=AdobeAcrobat").Activate

Window("regexpwndtitle:=Adobe Reader","regexpwndclass:=AdobeAcrobat").Close

End Function

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More QTP Interview Questions

Does QTP support Linux Red Hat? Does QTP support Flash?

4 Answers  


Discuss quicktest professional (qtp) environment?

0 Answers  


what is the default ordinal identifier.what are the send keys in qTP.

1 Answers  


What are the types of object repository in qtp?

0 Answers  


Define Environment Variable in UFT and its uses?

0 Answers  






HI. Plz Clarifie my doubt,having 2+yrs experience in Testing , But My accedamics(Xth,INTER) are Less than 60%, But B.Tech 72%. It creats any problem , When i change to any MNC. plz tell me......... lot of friends told it's a problem, Some people says NO problem, What .............

3 Answers  


What is QTP and the use of QTP in TD?

0 Answers   MaxSolPro,


how to test use the quality control .how to verify the image verification

0 Answers   Wells Fargo,


what type automation is fofollowed in the project?

1 Answers   Satyam,


what is throw object ?

1 Answers  


Is it possible to call from one action to another action in qtp?

0 Answers  


how will we run batch tests in qtp what is the process to run the multiple test sets?

3 Answers  


Categories