如何使用 QTP/VBScript 将 PDF 中的内容提取为字符串? [英] How to fetch the content from the PDF into a string using QTP/VBScript?

查看:61
本文介绍了如何使用 QTP/VBScript 将 PDF 中的内容提取为字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I need to validate a particular content from the PDF using QTP. How I can get the content from the PDF into the string Using QTP/VBScript. So that, I can validate the content in the PDF.

推荐答案

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

Do visit Here. You will get your answer, this is one of the menthod to work with PDF in QTP. You can also fetch data from PDF by passing Keys i,e, Ctrl+a then Ctrl+c then copy this data to Clipboard & use this data for comparing with your standard data

从 PDF 获取数据的示例函数,当 PDF 报表在浏览器中打开时,其创建时间在数据表中传递

Sample Function For Getting data from PDF, When PDF report is open in Broweser whose creation time is passed in datatable

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

如果这能解决您的问题,请告诉我,还有其他使用 QTP 进行 PDF 报告测试的替代方法

Let me know if this solves your problem, there are also other alternatives for PDF Report testing using QTP

这篇关于如何使用 QTP/VBScript 将 PDF 中的内容提取为字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆