how to save the annotation and load its to add more annotation

1,247 views
Skip to first unread message

Warit Khuntaraporn

unread,
Mar 6, 2017, 1:01:50 PM3/6/17
to PDFTron WebViewer
I can load the pdf file that embedded with annotation but when I use that file to load into the website the annotation doesn't appear on the website.

I already look at the tutorials and doesn't know how to get the .xod file and the serverUrl that has myAnnotationHandler.php

var myWebViewer = new PDFTron.WebViewer({
initialDoc: "mydoc.xod",
serverUrl: "http://myserver.com/myAnnotationHandler.php",
documentId: "unique-id-for-this-document",
enableAnnotations: true,
}, viewerElement);

Please give me some guideline to installation this method thanks.

Warit Khuntaraporn

unread,
Mar 7, 2017, 11:13:09 AM3/7/17
to PDFTron WebViewer
Now I can download the pdf with annotation by press download button but I want to download this file into the server the replace the old file how to config this button 

Warit Khuntaraporn

unread,
Mar 7, 2017, 12:14:35 PM3/7/17
to PDFTron WebViewer
I already can save the .xfdf file but I cannot load it to the current pdf please help.

Justin Jung

unread,
Mar 7, 2017, 3:07:37 PM3/7/17
to PDFTron WebViewer
Hello,

If you look at lib/html5/annotationHandler.php, it should have a basic implementation that handles AJAX requests to save/load annotations through xfdf. http://myserver.com is just an arbitrary url, which should be replaced with your own server url. Same thing for mydoc.xod, it is just an arbitrary name/path.

Replacing the file is also shown in annotationHandler.php. Basically, it uses http://php.net/manual/en/function.file-put-contents.php

The default setting in WebViewer uses xfdf file to save/load annotations. It makes a POST request when saving and a GET request when loading to the serverURL. You can change the serverURL to be whatever you want, as long as it handles the POST and GET request. 

Justin Jung
Software Developer
PDFTron Systems Inc.

--
You received this message because you are subscribed to the Google Groups "PDFTron WebViewer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pdfnet-webviewer+unsubscribe@googlegroups.com.
To post to this group, send email to pdfnet-webviewer@googlegroups.com.
Visit this group at https://groups.google.com/group/pdfnet-webviewer.
For more options, visit https://groups.google.com/d/optout.

Warit Khuntaraporn

unread,
Mar 8, 2017, 11:29:58 AM3/8/17
to PDFTron WebViewer
I closed the cookie in annotationHandler.php Is it occur any problems.

I just want to load the annotation back when I F5 the page mean that when I assign the did of document it should find the old annotation and load it to show on the page.

Thanks,

Warit


On Wednesday, 8 March 2017 03:07:37 UTC+7, Justin Jung wrote:
Hello,

If you look at lib/html5/annotationHandler.php, it should have a basic implementation that handles AJAX requests to save/load annotations through xfdf. http://myserver.com is just an arbitrary url, which should be replaced with your own server url. Same thing for mydoc.xod, it is just an arbitrary name/path.

Replacing the file is also shown in annotationHandler.php. Basically, it uses http://php.net/manual/en/function.file-put-contents.php

The default setting in WebViewer uses xfdf file to save/load annotations. It makes a POST request when saving and a GET request when loading to the serverURL. You can change the serverURL to be whatever you want, as long as it handles the POST and GET request. 

Justin Jung
Software Developer
PDFTron Systems Inc.
On Tue, Mar 7, 2017 at 9:03 AM, Warit Khuntaraporn via PDFTron WebViewer <pdfnet-webviewer+APn2wQd_08An0SZOwJlvSbzkMLzV9mJApfYhIcZBQU...@googlegroups.com> wrote:
I already can save the .xfdf file but I cannot load it to the current pdf please help.


On Tuesday, 7 March 2017 23:13:09 UTC+7, Warit Khuntaraporn wrote:
Now I can download the pdf with annotation by press download button but I want to download this file into the server the replace the old file how to config this button 

On Tuesday, 7 March 2017 01:01:50 UTC+7, Warit Khuntaraporn wrote:
I can load the pdf file that embedded with annotation but when I use that file to load into the website the annotation doesn't appear on the website.

I already look at the tutorials and doesn't know how to get the .xod file and the serverUrl that has myAnnotationHandler.php

var myWebViewer = new PDFTron.WebViewer({
    initialDoc: "mydoc.xod",
    serverUrl: "http://myserver.com/myAnnotationHandler.php",
    documentId: "unique-id-for-this-document",
    enableAnnotations: true,
}, viewerElement);

Please give me some guideline to installation this method thanks.

--
You received this message because you are subscribed to the Google Groups "PDFTron WebViewer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pdfnet-webview...@googlegroups.com.
To post to this group, send email to pdfnet-w...@googlegroups.com.

Warit Khuntaraporn

unread,
Mar 8, 2017, 11:29:58 AM3/8/17
to PDFTron WebViewer
Hi Justin Jung,

Thank you for your information, 

The POST request is ok I got the file 1.xfdf in annotation folder but when I refresh the page it doesn't call GET request to load my annotation from 1.xfdf this is my function in index.html

  $(function() {
            var viewerElement = document.getElementById('viewer');
            var myWebViewer = new PDFTron.WebViewer({
                type: "html5",
                path: "lib",
                initialDoc: "1.pdf",
                config: "config.js",
                serverUrl: "http://localhost/lib/html5/annotationHandler.php",
                documentId: "1",
                documentType: "pdf",
                showLocalFilePicker: true,
                enableAnnotations: true,
                pdfnet: true
            }, viewerElement);
        });

what I was misunderstanding please help

Thanks,
Warit

On Wednesday, 8 March 2017 03:07:37 UTC+7, Justin Jung wrote:
Hello,

If you look at lib/html5/annotationHandler.php, it should have a basic implementation that handles AJAX requests to save/load annotations through xfdf. http://myserver.com is just an arbitrary url, which should be replaced with your own server url. Same thing for mydoc.xod, it is just an arbitrary name/path.

Replacing the file is also shown in annotationHandler.php. Basically, it uses http://php.net/manual/en/function.file-put-contents.php

The default setting in WebViewer uses xfdf file to save/load annotations. It makes a POST request when saving and a GET request when loading to the serverURL. You can change the serverURL to be whatever you want, as long as it handles the POST and GET request. 

Justin Jung
Software Developer
PDFTron Systems Inc.
On Tue, Mar 7, 2017 at 9:03 AM, Warit Khuntaraporn via PDFTron WebViewer <pdfnet-webviewer+APn2wQd_08An0SZOwJlvSbzkMLzV9mJApfYhIcZBQU...@googlegroups.com> wrote:
I already can save the .xfdf file but I cannot load it to the current pdf please help.


On Tuesday, 7 March 2017 23:13:09 UTC+7, Warit Khuntaraporn wrote:
Now I can download the pdf with annotation by press download button but I want to download this file into the server the replace the old file how to config this button 

On Tuesday, 7 March 2017 01:01:50 UTC+7, Warit Khuntaraporn wrote:
I can load the pdf file that embedded with annotation but when I use that file to load into the website the annotation doesn't appear on the website.

I already look at the tutorials and doesn't know how to get the .xod file and the serverUrl that has myAnnotationHandler.php

var myWebViewer = new PDFTron.WebViewer({
    initialDoc: "mydoc.xod",
    serverUrl: "http://myserver.com/myAnnotationHandler.php",
    documentId: "unique-id-for-this-document",
    enableAnnotations: true,
}, viewerElement);

Please give me some guideline to installation this method thanks.

--
You received this message because you are subscribed to the Google Groups "PDFTron WebViewer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pdfnet-webview...@googlegroups.com.
To post to this group, send email to pdfnet-w...@googlegroups.com.

Justin Jung

unread,
Mar 8, 2017, 8:07:22 PM3/8/17
to PDFTron WebViewer
Hello Warit,

Currently there can be issues with loading annotations to linearized PDFs. To work around, you can set useDownloader: false in PDFTron.WebViewer constructor.
You can refer to the documentation about the useDownloader option: https://www.pdftron.com/webviewer/demo/doc/symbols/PDFTron.WebViewer.Options.html#useDownloader

Justin Jung
Software Developer
PDFTron Systems Inc.
On Tue, Mar 7, 2017 at 11:41 PM, Warit Khuntaraporn via PDFTron WebViewer <pdfnet-webviewer+APn2wQd_08An0SZ...@googlegroups.com> wrote:
I closed the cookie in annotationHandler.php Is it occur any problems.

I just want to load the annotation back when I F5 the page mean that when I assign the did of document it should find the old annotation and load it to show on the page.

Thanks,

Warit

On Wednesday, 8 March 2017 03:07:37 UTC+7, Justin Jung wrote:
Hello,

If you look at lib/html5/annotationHandler.php, it should have a basic implementation that handles AJAX requests to save/load annotations through xfdf. http://myserver.com is just an arbitrary url, which should be replaced with your own server url. Same thing for mydoc.xod, it is just an arbitrary name/path.

Replacing the file is also shown in annotationHandler.php. Basically, it uses http://php.net/manual/en/function.file-put-contents.php

The default setting in WebViewer uses xfdf file to save/load annotations. It makes a POST request when saving and a GET request when loading to the serverURL. You can change the serverURL to be whatever you want, as long as it handles the POST and GET request. 

Justin Jung
Software Developer
PDFTron Systems Inc.

On Tue, Mar 7, 2017 at 9:03 AM, Warit Khuntaraporn via PDFTron WebViewer <pdfnet-webviewer+APn2wQd_08An0SZOwJlvSbzkMLzV9mJApfYhIcZBQUh5...@googlegroups.com> wrote:
I already can save the .xfdf file but I cannot load it to the current pdf please help.


On Tuesday, 7 March 2017 23:13:09 UTC+7, Warit Khuntaraporn wrote:
Now I can download the pdf with annotation by press download button but I want to download this file into the server the replace the old file how to config this button 

On Tuesday, 7 March 2017 01:01:50 UTC+7, Warit Khuntaraporn wrote:
I can load the pdf file that embedded with annotation but when I use that file to load into the website the annotation doesn't appear on the website.

I already look at the tutorials and doesn't know how to get the .xod file and the serverUrl that has myAnnotationHandler.php

var myWebViewer = new PDFTron.WebViewer({
    initialDoc: "mydoc.xod",
    serverUrl: "http://myserver.com/myAnnotationHandler.php",
    documentId: "unique-id-for-this-document",
    enableAnnotations: true,
}, viewerElement);

Please give me some guideline to installation this method thanks.

--
You received this message because you are subscribed to the Google Groups "PDFTron WebViewer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pdfnet-webview...@googlegroups.com.
To post to this group, send email to pdfnet-w...@googlegroups.com.
Visit this group at https://groups.google.com/group/pdfnet-webviewer.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "PDFTron WebViewer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pdfnet-webviewer+unsubscribe@googlegroups.com.
To post to this group, send email to pdfnet-webviewer@googlegroups.com.

Warit Khuntaraporn

unread,
Mar 20, 2017, 12:01:22 PM3/20/17
to PDFTron WebViewer
Dear Justin,

I have a few question about annotation I want to add the annotation to mysql database for doing global search function on my web application. Can you give me some hint to do this things

Thanks,

Warit


On Thursday, 9 March 2017 08:07:22 UTC+7, Justin Jung wrote:
Hello Warit,

Currently there can be issues with loading annotations to linearized PDFs. To work around, you can set useDownloader: false in PDFTron.WebViewer constructor.
You can refer to the documentation about the useDownloader option: https://www.pdftron.com/webviewer/demo/doc/symbols/PDFTron.WebViewer.Options.html#useDownloader

Justin Jung
Software Developer
PDFTron Systems Inc.
On Tue, Mar 7, 2017 at 11:41 PM, Warit Khuntaraporn via PDFTron WebViewer <pdfnet-webviewer+APn2wQd_08An0SZOwJlvSbzkMLzV9mJApfYhIcZBQU...@googlegroups.com> wrote:
I closed the cookie in annotationHandler.php Is it occur any problems.

I just want to load the annotation back when I F5 the page mean that when I assign the did of document it should find the old annotation and load it to show on the page.

Thanks,

Warit

On Wednesday, 8 March 2017 03:07:37 UTC+7, Justin Jung wrote:
Hello,

If you look at lib/html5/annotationHandler.php, it should have a basic implementation that handles AJAX requests to save/load annotations through xfdf. http://myserver.com is just an arbitrary url, which should be replaced with your own server url. Same thing for mydoc.xod, it is just an arbitrary name/path.

Replacing the file is also shown in annotationHandler.php. Basically, it uses http://php.net/manual/en/function.file-put-contents.php

The default setting in WebViewer uses xfdf file to save/load annotations. It makes a POST request when saving and a GET request when loading to the serverURL. You can change the serverURL to be whatever you want, as long as it handles the POST and GET request. 

Justin Jung
Software Developer
PDFTron Systems Inc.

Justin Jung

unread,
Mar 20, 2017, 1:47:18 PM3/20/17
to PDFTron WebViewer
Hello Warit,

Sorry, I'm not quite sure what you mean. Are you looking for a functionality to search for an annotation from the database? Can you describe what you would want to search for?
Currently WebViewer is focused on the front-end of the application (documents and annotations), and we have left back-end to be open ended.
As per global search function, you can use either the search tab from left panel of the viewer, or use textSearchInit function (https://www.pdftron.com/webviewer/demo/lib/html5/doc/symbols/CoreControls.DocumentViewer.html#textSearchInit)

Justin Jung
Software Developer
PDFTron Systems Inc.
On Sun, Mar 19, 2017 at 11:58 PM, Warit Khuntaraporn via PDFTron WebViewer <pdfnet-webviewer+APn2wQd_08An0SZ...@googlegroups.com> wrote:
Dear Justin,

I have a few question about annotation I want to add the annotation to mysql database for doing global search function on my web application. Can you give me some hint to do this things

Thanks,

Warit


On Thursday, 9 March 2017 08:07:22 UTC+7, Justin Jung wrote:
Hello Warit,

Currently there can be issues with loading annotations to linearized PDFs. To work around, you can set useDownloader: false in PDFTron.WebViewer constructor.
You can refer to the documentation about the useDownloader option: https://www.pdftron.com/webviewer/demo/doc/symbols/PDFTron.WebViewer.Options.html#useDownloader

Justin Jung
Software Developer
PDFTron Systems Inc.
To unsubscribe from this group and stop receiving emails from it, send an email to pdfnet-webviewer+unsubscribe@googlegroups.com.
To post to this group, send email to pdfnet-webviewer@googlegroups.com.

Warit Khuntaraporn

unread,
Mar 20, 2017, 2:51:51 PM3/20/17
to PDFTron WebViewer on behalf of Justin Jung
I mean that how I can directly add the annotation to database. For example, I comment on the pdf file I want this comment added on my database to let my user searching. 

On Mar 21, 2017 12:47 AM, "PDFTron WebViewer on behalf of Justin Jung" <pdfnet-w...@googlegroups.com> wrote:
Hello Warit,

Sorry, I'm not quite sure what you mean. Are you looking for a functionality to search for an annotation from the database? Can you describe what you would want to search for?
Currently WebViewer is focused on the front-end of the application (documents and annotations), and we have left back-end to be open ended.
As per global search function, you can use either the search tab from left panel of the viewer, or use textSearchInit function (https://www.pdftron.com/webviewer/demo/lib/html5/doc/symbols/CoreControls.DocumentViewer.html#textSearchInit)

Justin Jung
Software Developer
PDFTron Systems Inc.
You received this message because you are subscribed to a topic in the Google Groups "PDFTron WebViewer" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pdfnet-webviewer/F0eHrysYolM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pdfnet-webviewer+unsubscribe@googlegroups.com.

Warit Khuntaraporn

unread,
Mar 22, 2017, 11:31:33 AM3/22/17
to PDFTron WebViewer on behalf of Justin Jung
Hello Justin Jung,

How can I get the document id from the notepanel.js? I want to save the word that user add an annotation to add to my database when the user click saves button now I get the this.$textarea.val() this will be the word the user comment but I don't know the current document id in notepanel.js to add it to my database.

Thank you,
Warit

2017-03-21 0:51 GMT+07:00 Warit Khuntaraporn <kowdy....@gmail.com>:
I mean that how I can directly add the annotation to database. For example, I comment on the pdf file I want this comment added on my database to let my user searching. 
On Mar 21, 2017 12:47 AM, "PDFTron WebViewer on behalf of Justin Jung" <pdfnet-webviewer@googlegroups.com> wrote:
Hello Warit,

Sorry, I'm not quite sure what you mean. Are you looking for a functionality to search for an annotation from the database? Can you describe what you would want to search for?
Currently WebViewer is focused on the front-end of the application (documents and annotations), and we have left back-end to be open ended.
As per global search function, you can use either the search tab from left panel of the viewer, or use textSearchInit function (https://www.pdftron.com/webviewer/demo/lib/html5/doc/symbols/CoreControls.DocumentViewer.html#textSearchInit)

Justin Jung
Software Developer
PDFTron Systems Inc.

Justin Jung

unread,
Mar 22, 2017, 11:31:33 AM3/22/17
to PDFTron WebViewer
Hello,

In that case, you would want to get xfdf of the annotation with importAnnotCommand (https://www.pdftron.com/webviewer/demo/lib/html5/doc/symbols/CoreControls.AnnotationManager.html#importAnnotCommand).
You can also refer to realtime-collaboration tutorial (http://pdftron.com/webviewer/demo/tutorials/realtime-collaboration.html).

Justin Jung
Software Developer
PDFTron Systems Inc.
On Mon, Mar 20, 2017 at 10:51 AM, PDFTron WebViewer <pdfnet-w...@googlegroups.com> wrote:
I mean that how I can directly add the annotation to database. For example, I comment on the pdf file I want this comment added on my database to let my user searching. 
On Mar 21, 2017 12:47 AM, "PDFTron WebViewer on behalf of Justin Jung" <pdfnet-webviewer@googlegroups.com> wrote:
Hello Warit,

Sorry, I'm not quite sure what you mean. Are you looking for a functionality to search for an annotation from the database? Can you describe what you would want to search for?
Currently WebViewer is focused on the front-end of the application (documents and annotations), and we have left back-end to be open ended.
As per global search function, you can use either the search tab from left panel of the viewer, or use textSearchInit function (https://www.pdftron.com/webviewer/demo/lib/html5/doc/symbols/CoreControls.DocumentViewer.html#textSearchInit)

Justin Jung
Software Developer
PDFTron Systems Inc.

Justin Jung

unread,
Mar 22, 2017, 4:33:02 PM3/22/17
to PDFTron WebViewer
Hello Warit,

Just so you know, comment information is already saved in the normal xfdf saving process that WebViewer uses. However, if you want to save it separately, you can get the document id from readerControl.docId.

Justin Jung
Software Developer
PDFTron Systems Inc.
Reply all
Reply to author
Forward
0 new messages