/
Pulsar System Interaction API
Pulsar System Interaction API
Export
saveAs
IMPORTANT: v15.0 introduces the new Edge Chromium-based PDF engine on Windows, which more closely matches Pulsar's Android PDF generation. Legacy Windows PDF generation will be DEPRECATED in late 2025, and REMOVED in Summer 2026 release. This will be a breaking change for Windows-specific PDF code. In the meantime, the "useEdge" print option (or the Edge PDF Printer PulsarSetting) can be used to test and develop against the newer functionality.
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 "datauri" : "data:image/jpeg;base64,/9j/4AA...", // optional -- this is a well-formed data URI containing data you wish to save to a file. None of the parameters below will take effect if this option is used. "format" : "image", // [DEPRECATED in v12.0] optional -- this is a string, either "image" or "pdf"-- default is "pdf" "imageformat" : "png", // [DEPRECATED in v12.0] optional -- this is a string, either "png" or "jpg" -- default is "png" "papersize" : "letter", // optional, can also be specified in printoptions -- this is a string, valid values: "letter", "a4", "legal" -- default is "letter" or "a4" based on your device settings "docnode" : "window.document", // optional (iOS, Android version 3.6.4+, Windows version 3.7.3+) -- this is a string, representing the html document node Pulsar will use to generate a PDF. For example, for a document in an iFrame, "window.frames[0].contentWindow.document". default is "window.document" "headernode" : "document.getElementById('my-header')", // defines the section of the current document that will be used by iOS and UWP as the repeating page header -- you must specify a header height in the printoptions below. SEE ABOVE FOR MORE DOCUMENTATION "footernode" : "document.getElementById('my-footer')", // defines the section of the current document that will be user by iOS and UWP as the repeating page header -- you must specify a footer height in the printoptions below. SEE ABOVE FOR MORE DOCUMENTATION "printoptions" : { // (All platforms, version 3.7.3+) supports the following optional options in any combination "topmargin": 28, // all margins specified in points-- 72 points per inch, 2.83465 points per mm "leftmargin": 28, "bottommargin": 28, "rightmargin": 28, "papersize": "a4", // overrides top-level papersize parameter, if specified "headerheight": 88, // optional, but necessary if you are supplying a header (also in points) SEE ABOVE FOR MORE DOCUMENTATION "footerheight": 40, // optional, but necessary if you are supplying a footer (also in points) SEE ABOVE FOR MORE DOCUMENTATION "useEdge": true, // NEW with 15.0- see warnings in the description above }, } }; bridge.sendRequest(request, function (results) { console.log('Javascript got its response: ' + JSON.stringify(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: ' + JSON.stringify(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: ' + JSON.stringify(results)); });
, multiple selections available,
Related content
Pulsar General Information API
Pulsar General Information API
More like this
Pulsar Attachment API
Pulsar Attachment API
Read with this
Pulsar Configuration API
Pulsar Configuration API
More like this
Salesforce Field Service API
Salesforce Field Service API
Read with this
Pulsar Deep Links
Pulsar Deep Links
More like this
Generating Your Own PDFs - Some best practices
Generating Your Own PDFs - Some best practices
Read with this