更新时间:2023-01-08 18:45:16
以下内容仅适用于Linux.首先,您的SWT版本必须为< Eclipse 4.8,请参阅 https://www.eclipse.org/swt/faq.php#browserlinux
The following applies to Linux only. First of all, your SWT version must be < Eclipse 4.8, see https://www.eclipse.org/swt/faq.php#browserlinux
如果您的SWT符合此条件,我知道有2种选择:
If your SWT meets this criterion, there's 2 options I know of:
将插件nppdf.so添加到您的xulrunner安装中,需要在PATH上具有匹配版本的Adobe Reader"acroread"可执行文件(也许acroread版本可以是> nppdf版本,对此不确定)
Add plugin nppdf.so to your xulrunner install, needs Adobe Reader "acroread" executable with matching version on the PATH (maybe acroread version can be > nppdf version, not sure about that)
使用pdf.js:我使用Eclipse 3.8.2,xulrunner 10.0.4esr和pdf.js< 2,例如1.10.100.
Use pdf.js: I got it to work using SWT from Eclipse 3.8.2, xulrunner 10.0.4esr and pdf.js < 2, e.g. 1.10.100.
更新:这种版本组合对pdf文件中的图片有问题,因此我不得不升级到:SWT 4.4和xulrunner24.pdf.js 1.10.100仍然有效,现在2.x也可以使用,但是.
UPDATE: this combination of versions has a problem with images in pdf-files, so I had to upgrade to: SWT 4.4 and xulrunner 24. pdf.js 1.10.100 still worked, 2.x would now also be usable, though.
在xulrunner安装中,创建包含以下内容的文件默认值/preferences/prefs.js(xulrunner.js也可以):
In your xulrunner install, create file defaults/preferences/prefs.js (xulrunner.js also works), containing this line:
pref("security.fileuri.strict_origin_policy", false);
要查看pdf文件,请将嵌入了swt的xul运行器指向
To view a pdf file, point your swt-embedded xul-runner to
file:///<pdf.js-dir>/web/viewer.html?file=<absolute-pdf-file-path>
这可能适用:
但是,我们确实会询问您是否打算将查看器嵌入到您自己的网站中, 它不仅是未修改的版本.请重新设置外观或构建 在它上面.
However, we do ask if you plan to embed the viewer in your own site, that it not just be an unmodified version. Please re-skin it or build upon it.
https://mozilla.github.io/pdf.js/getting_started/#download
来源: