dnL*_*nLL 7 pdf ms-access vba pdf-form
我想从我的MS-Access 2003 .mdb项目中填写PDF表单.PDF是使用Adobe LifeCycle Designer ES 8.2创建的,所有字段都有重要名称.但是,运行PDf-filling功能的用户没有安装LifeCycle,而只安装了Adobe Reader 9.5(可能很快就会迁移到Adobe Reader X,我希望我的代码有一点未来证明).
我该如何实现呢?我在Web上看到的大多数线程都重定向到官方的Adobe SDK文档,当你只做VBA时,这完全是一团糟.
谢谢.
最后设法在合并一些代码行后得到一些工作.这里是.它适用于我的VBA项目中作为参考设置的Adobe Acrobat 9.0类型库.
Dim FileNm, gApp, avDoc, pdDoc, jso
FileNm = "c:\form.pdf" 'File location
Set gApp = CreateObject("AcroExch.app")
Set avDoc = CreateObject("AcroExch.AVDoc")
If avDoc.Open(FileNm, "") Then
Set pdDoc = avDoc.GetPDDoc()
Set jso = pdDoc.GetJSObject
jso.getField("topmostSubform[0].Page1[0].fieldName[0]").value = "myValue"
pdDoc.Save PDSaveIncremental, FileNm 'Save changes to the PDF document
pdDoc.Close
End If
'Close the PDF; the True parameter prevents the Save As dialog from showing
avDoc.Close (True)
'Some cleaning
Set gApp = Nothing
Set avDoc = Nothing
Set pdDoc = Nothing
Set jso = Nothing
Run Code Online (Sandbox Code Playgroud)
请注意,这topmostSubform[0].Page1[0]是Adobe LiveCycle Designer为主PDF文档提供的默认名称,fieldName[0]而是您的字段的名称.如果您有多个具有相同名称的字段,Adobe LiveCycle Designer会自动添加索引编号,以便您可以轻松遍历字段.
| 归档时间: |
|
| 查看次数: |
22901 次 |
| 最近记录: |