使用 Javascript 从 Acrobat Reader 中的 PDF 中提取特定页面



我有一个由多个页面组成的PDF,用户可以选择打印。用户使用第一页上的一组复选框(即MRI,EEG等(进行选择。

有一个打印按钮,然后将勾选的任何页面发送到最近的打印机。我想知道是否可以调整此脚本以提取这些相同的页面,而不是本地保存在用户计算机上的PDF。

这可能吗?

var theMRI = this.getField("MRI").value;
var theEEG = this.getField("EEG").value;
var theMGL = this.getField("MGL").value;
var theCyto = this.getField("Cytogen").value;
var theMito = this.getField("Mitogen").value;
var theOutpt = this.getField("Outpt_Lab").value;
if (theMRI != "Off") this.print({bUI: false, bSilent: true, bShrinkToFit: true, nStart: 1, nEnd: 3});
if (theEEG != "Off") this.print({bUI: false, bSilent: true, bShrinkToFit: true, nStart: 4, nEnd: 4});
if (theMGL != "Off") this.print({bUI: false, bSilent: true, bShrinkToFit: true, nStart: 5, nEnd: 5});
if (theCyto != "Off") this.print({bUI: false, bSilent: true, bShrinkToFit: true, nStart: 6, nEnd: 7});
if (theMito != "Off") this.print({bUI: false, bSilent: true, bShrinkToFit: true, nStart: 8, nEnd: 9});
if (theOutpt != "Off") this.print({bUI: false, bSilent: true, bShrinkToFit: true, nStart: 10});

使用 Adobe Reader?不。Adobe Reader 無法修改 PDF 的頁面或頁面內容。然而。如果用户拥有Adobe Acrobat Standard或Pro,JavaScript可以使用类似于以下代码的内容将页面提取到新的PDF。PDF 页码从零开始,因此第一页为 0。第三个参数是提取页面的文件名。

this.extractPages(startPageNum, endPageNum, "extractedPages.pdf")

最新更新