如何用JSX脚本更新链接的PDF页面

编程语言 2026-07-10

我想遍历文档中的所有元素;如果它们链接了某个特定的PDF文件,就更新该文件链接到的页码。除了最后一步之外,我都能完成。

简而言之:如何使用JSX脚本来更新图框所链接的PDF的页码?

var allframes = app.activeDocument.allPageItems;
for (i = 0; i < allframes.length; i++) {
    // Pseudo code of the part I need help with:
    allframes[i].updateImportedPage(4)
}

非常感谢任何帮助!

解决方案

我必须把PDF再次放置,才能修改链接的页码。

// Original PDF file
var file = graphic.itemLink.filePath;

//Set placement preference (ie. the )
app.pdfPlacePreferences.pageNumber = newPage;

// Replace the PDF file with new page
graphic.parent.place(File(file));
站内所有文章版权归属LeftHeroAI导航站,无授权禁止任何主体转载、抄袭、复制内容,亦不得私自架设镜像站点。一经侵权,本站将通过法律途径追责。

相关文章