Powershell引用AcroExch Sample

 

 

# declare a COM object for the Acrobat application
# this doesn't show up in the Task Manager
$app = New-Object -ComObject AcroExch.App

# declare a COM object for PDDoc
$PDDoc = New-Object -ComObject AcroExch.PDDoc


# open a PDF
$PDDoc.Open('C:\Users\jtang20\Desktop\pdfFolder\test1.pdf')


# this displays the document in the acrobat instance and creates an AVDoc COM object
# at this point, acrobat shows up in the task manager
$AVDoc = $PDDoc.OpenAVDoc("")

# now I can use the FindText method
$AVDoc.FindText("123123",0,1,1)

# Gets the number of open AcroExch.AVDoc objects. 
$app.GetNumAVDocs()


# this hides the acrobat instance if it's visible
# acrobat disappears from the Task Manager
$app.Hide()

# housekeeping on the way out
$app.CloseAllDocs()

# supposedly "an application must explicitly close any AVDoc that it opens by calling AVDoc.Close", 
# but I'm getting a False in Powershell that makes me think this step isn't working
$AVDoc.Close(0)

[System.Runtime.Interopservices.Marshal]::ReleaseComObject($app)
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($AVDoc)
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($PDDoc)

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值