vba Microsoft Access 中的 PDF 缩略图和预览

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9336184/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 15:16:00  来源:igfitidea点击:

PDF thumbnails and preview in Microsoft Access

ms-accessvbapdf

提问by crush

I've got a Microsoft Access database, and some PDF files. Right now, my Access database just shows a link to the PDF file with a .pdf generic icon.

我有一个 Microsoft Access 数据库和一些 PDF 文件。现在,我的 Access 数据库只显示一个带有 .pdf 通用图标的 PDF 文件链接。

What I want is a thumbnail view (like you get in Windows Explorer) of the PDF.

我想要的是 PDF 的缩略图视图(就像您在 Windows 资源管理器中看到的那样)。

Second, right now when I click the PDF link, it is opening the PDF externally in Adobe Reader. How can I get it to open in preview mode within Access?

其次,现在当我单击 PDF 链接时,它正在 Adob​​e Reader 中从外部打开 PDF。如何让它在 Access 中以预览模式打开?

采纳答案by Philippe Grondier

All of these will need the use of an embedded activeX control in your access app. There are many of them, some free, some not, depending on what you are planning to do. For a 'view only' use, I think you should be able to find something free. We have been using the foxit readerand the more complex amyunicontrols in our apps with some success.

所有这些都需要在您的访问应用程序中使用嵌入式 ActiveX 控件。其中有很多,有些是免费的,有些不是,这取决于您打算做什么。对于“仅查看”用途,我认为您应该能够找到免费的东西。我们一直在我们的应用程序中使用Foxit阅读器和更复杂的amyuni控件,并取得了一些成功。

The principle are the following:

其原理如下:

  • You have to add the corresponding activeX file in the available references of your app (VBA screen, tools, select)
  • You can then insert the corresponding control on a form, altogether with some 'empty' menus or controls
  • You can use these menus or controls to initiate the different methods available for the PDF control (choose a file, next/previous page, zoom in/out, etc.)
  • Depending on the vendor, some of these methods can be directly embedded in the activeX control
  • I am sure you can google and find some examples of such work with VBA or even VB
  • 您必须在应用程序的可用引用中添加相应的 ActiveX 文件(VBA 屏幕、工具、选择)
  • 然后,您可以在表单上插入相应的控件,以及一些“空”菜单或控件
  • 您可以使用这些菜单或控件来启动可用于 PDF 控件的不同方法(选择文件、下一页/上一页、放大/缩小等)
  • 根据供应商的不同,其中一些方法可以直接嵌入到 ActiveX 控件中
  • 我相信你可以在谷歌上找到一些使用 VBA 甚至 VB 进行此类工作的示例

If you distribute your access app, you will then have to distribute the activeX file with it. In most of the cases (if not all), distribution of the activeX file is free.

如果您分发访问应用程序,则必须随它分发 activeX 文件。在大多数情况下(如果不是全部),activeX 文件的分发是免费的。

回答by Albert D. Kallal

As a normal rule, I don't like embedding things that use external software inside of a form.

通常,我不喜欢在表单中嵌入使用外部软件的东西。

However, Access 2010 does have a new web control. You place that control in a form and set the URL to the path name of the pdf (or picture etc.) then it will render and display that pdf inside of the form. This works quite well as long as some pdf viewer is installed.

但是,Access 2010 确实有一个新的 Web 控件。您将该控件放在表单中并将 URL 设置为 pdf(或图片等)的路径名,然后它将在表单内呈现并显示该 pdf。只要安装了一些 pdf 查看器,这就会很好地工作。

I do caution these approaches since updates to PDF viewer or even users having a different pdf viewer can often cause problems and cost you support dollars. As noted, I think using the new web browser control is risky, but at least far less risk than most methods. Since the new browser control is native to Access 2010, then you can quite much attempt this idea in production code, but I would still try to stick with a simple click to view that launches whatever pdf software the user happens to be running on that computer.

我确实谨慎使用这些方法,因为对 PDF 查看器的更新或什至拥有不同 pdf 查看器的用户通常会导致问题并花费您支持美元。如前所述,我认为使用新的 Web 浏览器控件是有风险的,但至少比大多数方法的风险要小得多。由于新的浏览器控件是 Access 2010 的本机控件,因此您可以在生产代码中尝试这种想法,但我仍然会尝试坚持使用简单的单击来查看它会启动用户碰巧在该计算机上运行的任何 pdf 软件.