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

Define Canvas view of UFT?

0 Answers  


Can you expect major bugs in Net banking Application?

1 Answers  


what is the difference between modular framework & datadriven framework

0 Answers   SDS,


can any boby tell me what is method or steps to connect the remote desk top by using QTP 9.2 version?

0 Answers  


how qtp handles customised object

1 Answers  


how we do database testing with qtp using descriptive programming?

22 Answers   Nutrins, Rohit Technologies, Symphony, Syntel, TCS,


what is the difference between quality and testing ?

2 Answers  


write is the code for regular expression in QTP

2 Answers   IBM, Infosys,


Explain in brief about the QTP Automation Object Model.

0 Answers   Crea,


wht is Manual Testing Frame work. Pls anybody can give appropriate answers

0 Answers   Satyam,


How to invoke QTP using Dos prompt ?

2 Answers   ABC,


Dear Friends, I having total 3+year experience in manual testing including automation testing QTP, if i am attending any interview what kind of question will i get? please help me out

0 Answers  


Categories