Object “printer”

Object > NativeObject > Printer

Allows to print PDF documents or images from the device. A printer object is always available from tabris.printer.

Printer on Android
Printer on iOS
Constructor private
Singleton printer
Namespace tabris
Direct subclasses None
JSX support No


import {printer} from 'tabris';

const imageData = new Uint8Array([]);
printer.print(imageData, {jobName: 'Image', contentType: 'image/jpg'})
  .then(({result}) => console.log('Printing finished with result ${result}'))
  .catch(err => console.error(err));

See also:

JS How to print a PDF document bundled with an app


print(data, options?)

Prints a PDF document using the native printing capabilities of the device. The data has to be provided as an ArrayBuffer or typed array. The method returns a promise which resolves to an event object with the property result. The result can either be completed or canceled. When printing fails the promise is rejected with an Error parameter containing additional information about the error. Supported on iOS and Android 4.4+.

Parameter Type Optional Description
data any No The bytes of the document to print. The value can either be an ArrayBuffer or a typed array containing the bytes of a PDF document or image.
options {jobName?: string, contentType?: string} Yes An optional set of configuration parameters. Setting the jobName allows to provide the document name shown the user. The contentType is required when printing a specific document format. By default application/pdf is used but it needs to be changed to image/* when printing an image

Returns Promise<any>