70026

How to get form data from pdftron webviewer

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

Answer1:

config.js is the preferred place for webviewer modifications because it executes in the context of the viewer's iframe window. More on this in the following tutorial:

https://www.pdftron.com/webviewer/demo/tutorials/getting-started-config-files.html

Alternatively you could access iframe variables through contentWindow as described in the following post: https://stackoverflow.com/a/13758233/1710586

Recommend

  • Cannot invoke 'decode' with an argument list of type '(T, from: Data)'
  • Resolve HTTP 304 - not modified in AJAX call made via GWT
  • WCF Server Configuration for ws2007FederationHttpBinding and Windows Authentication
  • Why do CouchDB reduce functions receive 'keys' as an argument
  • 403 error from Google Drive direct link due to multiple accounts logged in
  • I need to remove leading zeros after a decimal point
  • Best way to pass variable from config file in .net MVC4 to Angular scope
  • DriveApp conversion from DocX to PDF fails (google apps script)
  • passing parameter to server in ExtJs
  • Valums Ajax file Upload handle the up. file?
  • Jquery ajax request not able to return data to other function
  • How to import Navit into Eclipse and use it in own android project
  • HABTM associations in Rails : collecting and counting the categories of a model's children
  • Attemping to change attributes of $(this) inside success function
  • Save website uploads in a subdomain
  • How to add regEx in angular filter
  • insert a picture into database(sqlite) with java code. what should i do?
  • How to synchronize two scrollview in Android?
  • Using android opencv apps without downloading opencv sdk manager
  • Google OAuth: can't get refresh token with authorization code
  • Add reference to ASP.NET 5 Class Library from Framework 4.5 Class Library Project
  • IE11 throwing “SCRIPT1014: invalid character” where all other browsers work
  • nonblocking BIO_do_connect blocked when there is no internet connected
  • Adjust width of select element according to selected option's width
  • Abort upload large uploads after reading headers
  • Django rest serializer Breaks when data exists
  • Get data from AJAX - How to
  • Bug in WPF DataGrid
  • Circular dependency while pushing http interceptor
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • AngularJs get employee from factory
  • Free memory of cv::Mat loaded using FileStorage API
  • How to set the response of a form post action to a iframe source?
  • How do I configure my settings file to work with unit tests?
  • Memory offsets in inline assembly
  • Change div Background jquery
  • Turn off referential integrity in Derby? is it possible?
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • Binding checkboxes to object values in AngularJs
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize