API: Capture Screenshots & Signatures

Allows you to capture a screenshot of the current view of the screen and to save it locally as an image file. Signatures can also be captured by creating an HTML5 canvas for drawing on-screen via touch, then capturing the result.

Resulting files can be accessed directly on the device by a locally stored HTML page, manually transferred to a computer, or retrieved remotely through Dropbox Sync. Files can also be managed using the Manage Local Files API.

Requirements

Kiosk Pro Plus and Enterprise

  • Integration of our JavaScript API into your webpage
    • Sample code to run within the app and download for integration into your own project is available here.
    • Best practices for working with the JavaScript API are available here.
  • App Settings
    • Content > JavaScript API > Access JavaScript API = By Import
  • Storage of resulting files in Kiosk Pro's Documents folder
    • Due to sandboxing in iOS/iPadOS, Kiosk Pro is unable to store local files outside of its own Documents folder. 


Triggers via API Functions

Capture Screenshot

This function triggers a screen capture and saves the result in the local Kiosk Pro documents folder. As this results in an image file, the result can also be translated into a Base64 text string for upload to a database.

The sample code also shows an example of creating an HTML5 canvas for drawing a signature on-screen by touch - the result can then be captured by this call.

Format
saveScreenToPng(filename, x-axis, y-axis, width, height, callback);
		
Parameters
  • filename - [required, string] the name of the image file without any file extension (images are automatically saved in .png format). The filename must be generated dynamically to be unique or will save over previous file each time it is called
  • x-axis - [required, number] the number of pixels from the left edge of the page where the saved area will begin
  • y-axis - [required, number] the number of pixels from the top edge of the page where the saved area will begin
  • width - [required, number] the width of the area to be saved in pixels
  • height - [required, number] the height of the area to be saved in pixels
  • callback - [optional, string] the name of the callback to be triggered after the function has been executed
Callback format
callback(success);
		
Callback return values success - if defined, the function successfully captured and saved an image to the Kiosk Pro document's folder.


Sample Code

  • This sample code relies on the JavaScript APIs built into Kiosk Pro and will not run successfully in other browsers or within our in-app help interface.
  • To run sample code, set the app's homepage to kioskgroup.com/screencapture-api
  • To download a .zip of sample code, click here.

Change Log

  • Added in version 1.3

Still stuck? How can we help? How can we help?