Export
saveAs
var request = { "type" : "saveAs", "data" : { "filename" : "demo.png", // the filename of the created file - required "displayresult" : 0, // this is a number, positive to display the file, 0 to simply return data "format" : "image" // this is a string, either "image" or "pdf"-- default is "pdf" } }; bridge.sendRequest(request, function (results) { console.log('Javascript got its response: ' + str(results)); if (results.type === "saveAsResponse") { var imageFilePath = results.data.FilePath; // the resulting contains the file path to the file //do something with the data } else if (results.type == 'error') { errStr = results.data; alert('A problem occurred:\n' + errStr); } });
print
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); } });
Communication
mail
var request = { "type" = "mail"; "data" = { "to" : [ "list_of@emails.com" ], // array of emails, optional "cc" : [ "list_of_cc@emails.com" ], // array of emails, optional "attach" : [ "/list/of/file/paths" ], // array of file paths to attach, optional "subject": "subject of this email", // email subject text, optional "body" : "body of the email ", // body text, optional }; bridge.sendRequest(request, function (results) { console.log('Javascript got its response: ' + str(results)); });