var request = {
"type" : "saveAs",
"data" : {
"filename" : "demo.png", // required -- the filename of the created file
"displayresult" : 0, // optional -- this is a number, positive to display the file, 0 to simply return data, default is 0
"format" : "image", // optional -- this is a string, either "image" or "pdf"-- default is "pdf"
"imageformat" : "png", // optional -- this is a string, either "png" or "jpg" -- default is "png"
"papersize" : "letter" // optional -- this is a string, valid values: "letter", "a4", "legal" -- default is "letter" or "a4" based on your device settings
}
};
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);
}
});
|