如何使用 QTP/VBScript 将 PDF 中的内容提取到字符串中?

发布于 2025-01-06 06:28:04 字数 119 浏览 3 评论 0原文

我需要使用 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无名指的心愿 2025-01-13 06:28:04

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

从 PDF 获取数据的示例函数,当在浏览器中打开 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

让我知道这是否解决了您的问题,还有其他替代方法用于 PDF 报告测试QTP

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

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

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文