简体   繁体   English

如何在Node.js中的pdftron中保存注释?

[英]How to save annotations in pdftron in Nodejs?

I need to upload PDF , highlight some text, add annotation note for the highlighted text and save edited PDF along with highlighted text & annotation notes in Nodejs. 我需要上传PDF,突出显示一些文本,为突出显示的文本添加注释注释,并在Node.js中将编辑的PDF连同突出显示的文本和注释注释一起保存。 I'm using PDFTron in this regard and its doing fine till uploading, highlighting and writing note for highlighted part but unable to save the data. 在这方面,我正在使用PDFTron ,直到上传,突出显示和为突出显示的部分编写注释,但无法保存数据之前,它的性能都很好。

What I get from PDFTron guide is that clicking the save button of the note container (to which I'm considering annotation If I'm not wrong) will send 'POST Request' to the server URL for saving the note. 我从PDFTron指南中得到的是,单击笔记容器的保存按钮(如果我没记错的话,我正在考虑对其进行注释)会将“ POST请求”发送到服务器URL以保存笔记。 It hits the server URL on page reload for loading the saved annotations but don't send any POST request on the same server URL for saving annotations on clicking save button. 它会在页面重新加载时命中服务器URL以加载已保存的注释,但是在单击保存按钮时不会在同一服务器URL上发送任何POST请求以保存注释。

Here's my webviewer initialization code: 这是我的webviewer初始化代码:

var myWebViewer = new PDFTron.WebViewer({
    type: "html5",
    path: "/lib",
    initialDoc: "/GettingStarted.pdf",
    serverUrl: "/annotations", //server URL to save & load annotation
    documentType: docType,
    config: "/lib/config.js",
    documentId: "GettingStarted",
    enableAnnotations: true,
    useDownloader: false,
    streaming: false
}, viewerElement);

Please point out If I misunderstood any step or I'm doing something wrong. 请指出如果我误解了任何步骤或做错了什么。

In the annotation side bar there is a pull-down menu(arrow down icon) where you click and the save button is displayed there. 在注解侧栏中,有一个下拉菜单(箭头向下图标),您单击即可在其中显示保存按钮。 Knowing this, it is not user friendly so create you own button and fire it manually. 知道这一点,它不是用户友好的,因此创建您自己的按钮并手动触发它。 You can fire it manually with: 您可以使用以下方法手动将其触发

myWebViewer.instance.saveAnnotations();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM