Adil
Adil

Reputation: 22441

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. 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.

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. 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.

Here's my webviewer initialization code:

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.

Upvotes: 0

Views: 1184

Answers (1)

jonesk
jonesk

Reputation: 113

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();

Upvotes: 1

Related Questions