I have a PDFTron webviewer which I use to render a pdf form. I need to extract the form xml from the webviewer when user click on external save button.
I tried
var am = readerControl.docViewer.getAnnotationManager();
var xfdfString = am.exportAnnotations();
$.ajax({
type: 'POST',
url: readerControl.serverUrl + '?did=' + readerControl.docId,
data: xfdfString,
success: function(data) {
// Annotations were successfully uploaded to server
},
error: function(jqXHR, textStatus, errorThrown) {
console.warn("Failed to send annotations to server. " + textStatus);
},
dataType: 'xml'
});
But I cannot get hold of readerControl
outside the PDFTron config.js
.
Please help