Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Export
saveAs

The saveAs operation will allow you to generate and display a PDF file of the currently displayed document. This is useful for exporting displayed data or saving completed forms. You also have the option to immediately display the generated file or to return the base64-encoded data for uploading or other purposes. In the below example we return PDF data.

var request = { 
	"type" : "saveAs",
	"data" : { 
				"filename" : "demo.pdf", // the filename of the created PDF file - required
				"displayresult" : 0      // this is a number, positive to display the file, 0 to simply return data
			 }
};

bridge.sendRequest(request, function (results) {
   console.log('Javascript got its response: ' + str(results));
   if (results.type === "saveAsResponse")	{
     var pdfData = results.data;  // the resulting data is the base64 encoded string
      //do something with the data
   } else if (results.type == 'error') {
         errStr = results.data;
         alert('A problem occurred:\n' + errStr);
   }
});
    
print

The print operation will allow you to print the currently displayed document using the available system printing resources. This is useful for printing displayed data or saving completed forms (for example, printing to a file, if the option is available)

var request = { 
	"type" : "print",
	"data" : { 
				// data is empty
			 }
};

bridge.sendRequest(request, function (results) {
   console.log('Javascript got its response: ' + str(results));
   if (results.type === "printResponse")	{
      // success case
   } else if (results.type == 'error') {
         errStr = results.data;
         alert('A problem occurred:\n' + errStr);
   }
});
    
  • No labels