【问题标题】:Create and show a PDF file from a Lotus Notes action从 Lotus Notes 操作创建和显示 PDF 文件
【发布时间】:2016-07-25 14:56:23
【问题描述】:
我正在使用表单中的操作来创建 Word 文档,使用 CreateObject("Word.application") 方法,然后根据自己的喜好对其进行修改并将其保存在临时目录中。
我可以通过调用 nameOfTheDocument.visible(true) 在创建 Word 文档后立即显示它,并通过修改保存操作我可以将新创建的文档另存为 PDF,但是我找不到方法将其展示给用户。
尝试在 PDF 对象上调用 visible(true) 会导致错误“实例成员 VISIBLE 不存在”
【问题讨论】:
标签:
pdf-generation
lotus-notes
lotusscript
【解决方案1】:
我们过去曾使用 Shell 命令来启动 PDF。像下面这样的东西。唯一的缺点是如果可执行文件的位置发生变化(无论是升级还是更改为不同的程序),代码就会中断。
Dim ProgPath$, FilePath$
Dim result As Integer
'Path of the executable
ProgPath$ = |"C:\Program Files (x86)\Adobe\Acrobat 7.0\Acrobat\Acrobat.exe"|
'Path of the file to open
FilePath$ = | "C:\TestFile.PDF"|
result = Shell(ProgPath$ & FilePath$,1)
【解决方案2】:
嗯...最好和正确的方法 - 使用操作系统文件关联。
我用的是java方式:
//Win
Process p = Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + filePath);
p.waitFor();
//MacOS.*Nix
Process p = Runtime.getRuntime().exec("/usr/bin/open " + filePath);
p.waitFor();
但是你可以在 Lotusscript 上调用这个命令:
Shell({rundll32 url.dll,FileProtocolHandler } & fullFilePath,1)
'or
Shell({/usr/bin/open } & fullFilePath,1)