Adobe PDF嵌入式API-如何生成元数据的文件ID



我正在使用Adobe PDF Embedded API来查看、编辑&保存PDF,它工作正常。

为了获得注释,我找到了以下代码:

document.addEventListener("adobe_dc_view_sdk.ready", function()
{
var adobeDCView = new AdobeDC.View({clientId: "<YOUR_CLIENT_ID>", divId: "adobe-dc-view"});
var previewFilePromise = adobeDCView.previewFile({
content:   {location: {url: "https://documentcloud.adobe.com/view-sdk-demo/PDFs/Bodea Brochure.pdf"}},
//id is 
metaData:  {
fileName: "Bodea Brochure.pdf", 
/* file ID */
id: "77c6fa5d-6d74-4104-8349-657c8411a834"}
},
{
enableAnnotationAPIs: true,
});

previewFilePromise.then(adobeViewer => {
adobeViewer.getAnnotationManager().then(annotationManager => {
// All annotation APIs can be invoked here
});
});
});

从文档中找到此注释:

To enabled the annotation APIs, you must pass a PDF ID in the metadata field when invoking the previewFile API. This ID uniquely identifies the PDF so that annotations can be added.

有人能告诉我如何获得PDF ID添加到metaData对象中吗。

您可以简单地提供任意字符串作为id。它应该是特定于文档的,例如您可能在应用程序中生成的数据库ID。如果您可以放心地假设它是唯一的,它也可以是文档的名称。

这个想法似乎是为了区分不同的、平行的注释过程。但从文档中并没有完全清楚这个id的实际用途,比如它是否只是在浏览器中本地使用。

最新更新