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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What is action?

654


when I was doing the web testing with QTP using with standard checkpoint the Object selection -checkpoint properties dialog box not displaying pages and links hierarchical order. Could you please tell me. thanks

1834


tell me abt a time when u had to go above &beyind the call of duty to get the job done

1552


What is the difference between byref and byval in qtp?

675


What is the syntax to call one script from another?

625






What is QTP testing process?

702


How many add-ins comes by default with quicktest professional (qtp)?

654


What does mean by Scope of Automation?n How we defined it?

1654


What is fragmentation and paging?

1671


If an application name changes frequently i.e while recording it has the name, in this case, how do qtp handles?

677


Hi, I'm a beginner in QTP and planning of a certification in QTP, but have no idea about it :P. Could anyone please tell me what certifications that a QTP- beginner can take? What is the fees and the syllabus for the certification? Please reply soon. Thanks Vidhya

1516


This is Karthic and my mail id is karthic.venkitapathi@gmail.com, please give me an idea to crack qtp 10

1600


How you can decide which type of object repository you have to use?

785


What is different command used in command Prompt while using QTP?

1852


Define Canvas view of UFT?

711