javascript - 如何在 Adobe Embed Api 中打开 pdf 并跳转到特定页面?
问题描述
我使用 Angular 示例在 Angular 中实现了 adobe embed api,现在我想跳转到特定页面
示例:我打开 example.pdf 它有 14 页,我想跳到第 3 页,我该怎么做。
在这个https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/PDFOpenParameters.pdf中,我看到了我们可以在 pdf URL 之后添加的页面属性,例如 example.pdf#page= 3 所以它会直接跳到那个pdf的第三页。
但是当我实现该属性时,它不会跳转到该页面
对此的任何建议表示赞赏,在此先感谢
解决方案
最终能够使用 adobe embed api 中的 goToLocation 函数跳转到特定页面。
如需参考,请查看https://www.adobe.io/apis/documentcloud/dcsdk/docs.html?view=view
const previewFilePromise = this.pdfRef = this.adobeDCView.previewFile({
content: {
location: {
url: fileName,
}
},
metaData: {
fileName: 'my file.pdf',
id: "filed"
}
},viewerConfig);
previewFilePromise.then((adobeViewer:any) => {
adobeViewer.getAPIs().then((apis:any) => {
apis.gotoLocation(<Page_Number>, <X_Coordinate>, <Y_Coordinate>)
.then(() => console.log("Success"))
.catch((error:any) => console.log(error));
});
})
X 和 Y 坐标是可选的,因此使用此功能我们可以使用我们自己的自定义按钮转到 iframe 内的任何页面
推荐阅读
- laravel - mb_strpos() 期望参数 1 是字符串,在 Laravel 中查询 2 个表时给出的对象
- arrays - 如何从Matlab中的变量中获取单元格编号时在excel中读取一行?
- python - 如何从 sklearn.neighbors.KDTree 中检索节点?
- reactjs - 反应 scrollIntoView 未定义
- php - 如何将 php 数组作为 ajax 调用中的 post 参数传递给 url 中的 php 文件
- java - SCOPE_SINGLETON 和私有构造函数的区别
- git - 为什么合并后再次变基不是一个好习惯?
- python - 如何使用随机数作为 if 语句的输入?
- python-3.x - 如何使用python查看外面有多少光
- twilio - Twilio twiml 记录修剪选项不起作用