Download file with/without annotations from viewer

128 views
Skip to first unread message

Pawan Kumar

unread,
Jan 3, 2017, 12:40:09 PM1/3/17
to PDFTron WebViewer
Hi Team,

We are using the licensed version of PDFNetJs. We have a requirement where we want to download file with/without annotations drawn on pdftron viewer based on user requirement. It could be some flag on/off value based on that we will decide that user wants to download pdftron viewer file with or without annotations even if annotations are showing in viewer. Can you please suggest solution for this?

Regards,
Pawan

Matt Parizeau

unread,
Jan 3, 2017, 5:11:16 PM1/3/17
to PDFTron WebViewer
Hi Pawan,

You could override the default behavior of the download button and call the downloadFile button with an empty XFDF string in the case where you don't want any annotations in the downloaded file. For example:

$(document).on('viewerLoaded', function() {
  $
('#downloadButton').off().on('click', function() {
   
if (downloadWithAnnotations) {
      readerControl
.downloadFile();
   
} else {
     
var emptyXfdf = '<xfdf></xfdf>';
      readerControl
.downloadFile(emptyXfdf);
   
}
 
});
});

Matt Parizeau
Software Developer
PDFTron Systems Inc.

Pawan Kumar

unread,
Jan 4, 2017, 12:46:20 PM1/4/17
to PDFTron WebViewer
Hi Matt,

I have tried this code, but on download button click, I am getting attached error. It seems it is not a valid method name. I have attached the error I am getting in browser console.

Regards,
Pawan
downloadfile method error.png

Pawan Kumar

unread,
Jan 5, 2017, 8:00:38 PM1/5/17
to PDFTron WebViewer
Hi Matt,

Any update on this.

Regards,
Pawan

Matt Parizeau

unread,
Jan 6, 2017, 3:05:01 PM1/6/17
to PDFTron WebViewer
Hi Pawan,

Which version of WebViewer are you using? The downloadFile function was only added to readerControl in version 2.2.1. If you're still having problems with 2.2.1 then let us know.

Matt Parizeau
Software Developer
PDFTron Systems Inc.
Reply all
Reply to author
Forward
0 new messages