如何使用QTP/VBScript将PDF中的内容转换为字符串?

Sur*_*h.D 2 validation vbscript qtp

我需要使用QTP验证PDF中的特定内容.如何将PDF中的内容导入到使用QTP/VBScript的字符串中.这样,我就可以验证PDF中的内容.

4m0*_*m01 5

请访问这里.您将得到答案,这是在QTP中使用PDF的方法之一.您也可以通过传递Keys i,e,Ctrl + a然后按Ctrl + c从PDF获取数据,然后将此数据复制到剪贴板并使用此数据与标准数据进行比较

示例函数用于从PDF获取数据,在Broweser中打开PDF报表时,其创建时间在数据表中传递

Public function CopyPDFData(sDestinationFile)       
Dim clip, strText, nCT, fso

nCT = DataTable("bPDFCreationTime", dtLocalSheet)
If nCT =""  Then nCT=1
Browser("CreationTime:=" & nCT).Sync

Browser("CreationTime:=" & nCT).FullScreen            
wait(2)
Browser("CreationTime:=" & nCT).WinObject("object class:=AVL_AVView", "text:=AVPageView").Type micCtrlDwn + "a" + micCtrlUp
wait(4)
Browser("CreationTime:=" & nCT).WinObject("object class:=AVL_AVView", "text:=AVPageView").Type micCtrlDwn + "c" + micCtrlUp
wait(4)

Set clip = CreateObject("Mercury.Clipboard" )
strText = clip.GetText
clip.Clear

Set fso = CreateObject("Scripting.FileSystemObject")
Set strfile = fso.CreateTextFile(sDestinationFile, True) 
strfile .Write  strText
strfile .Close
Browser("CreationTime:=" & nCT).sync
Browser("CreationTime:=" & nCT).close
End Function
Run Code Online (Sandbox Code Playgroud)

如果这解决了您的问题,请告诉我,使用QTP进行PDF报告测试还有其他选择