vba - 从 pdf 中提取特定数据点。出现“类未注册”错误
问题描述
我正在尝试在 pdf 中搜索字符串并在这些字符串之后提取数据点。但是我在这行代码中收到“类未注册”错误。我使用的参考是 Adobe Acrobat 8.0 Type Library 请帮忙。谢谢
If (objAvDoc.Open(strFilename, "")) Then
上面一行的语法错误
Sub callFunc()
getTextFromPDF ("C:\XXXXXX\XXXXX\6. CDS vs FA\052835022.pdf")
End Sub
Function getTextFromPDF(ByVal strFilename As String) As String
Dim objAVDoc As New AcroAVDoc
Dim objPDDoc As New AcroPDDoc
Dim objPage As AcroPDPage
Dim objSelection As AcroPDTextSelect
Dim objHighlight As AcroHiliteList
Dim pageNum As Long
Dim strText As String
strText = ""
If (objAvDoc.Open(strFilename, "")) Then
Set objPDDoc = objAVDoc.GetPDDoc
For pageNum = 0 To objPDDoc.GetNumPages() - 1
Set objPage = objPDDoc.AcquirePage(pageNum)
Set objHighlight = New AcroHiliteList
objHighlight.Add 0, 10000 ' Adjust this up if it's not getting all the text on the page
Set objSelection = objPage.CreatePageHilite(objHighlight)
If Not objSelection Is Nothing Then
For tCount = 0 To objSelection.GetNumText - 1
strText = strText & objSelection.GetText(tCount)
Next tCount
End If
Next pageNum
objAVDoc.Close 1
End If
getTextFromPDF = strText
End Function
解决方案
推荐阅读
- html - 当我将类属性放在表单标签中时,我的“style.css”文件不起作用
- spring-integration - Spring Integration kafka 出站通道适配器
- excel - 尝试删除查询表刷新代码中的选择时遇到的问题
- perl - 导出器模块默认导入例程未按预期运行
- kubernetes - 如何在 CustomResourceDefinitions 更改后更新资源
- javascript - Angular 上 Bootstrap 模态的奇怪行为
- python - 另一个用户授予访问权限
- sql - 上一年和当年
- python - 由于 EnvironmentError 无法安装软件包:[Errno 2] 没有这样的文件或目录 \\METADATA
- wordpress - 如何在 WordPress 中更改博客终端的字体和背景颜色?