Capture API: Screen Capture

Functions

The Screen Capture API allows you to capture a screenshot of the current view of the screen and to save it locally as an image file. Parameters of the function let you define the filename used, whether to capture the entire screen or just a portion of it, and to trigger a callback once the capture has been saved successfully.

The screen capture function can be used in combination with an HTML5 canvas in your code to capture visitor signatures and/or drawings as shown in one of our demo samples.

Requirements

  • Access JavaScript API
    • By Import - recommended, works both online & offline, requires inclusion of kiosk_functions.js prior to any of the following calls.
    • By Injection - only works offline, may not be available 'onload'.

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 http://www.kioskproapp.com/screencap

Download Sample Code


saveScreenToPng

This function triggers a screen capture and saves the result in the local Kiosk Pro documents folder.

Format
saveScreenToPng(filename, x-axis, y-axis, width, height, callback);
		
Parameters
  • filename = [required] 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] defines the number of pixels from the left edge of the page where the saved area will begin.
  • y-axis = [required] defines the number of pixels from the top edge of the page where the saved area will begin.
  • width = [required] the width of the area to be saved in pixels.
  • height = [required] the height of the area to be saved in pixels.
  • callback = [optional] name of callback function which will be called with the following signature: callback(success).
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.

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