Object “printer”
Object > NativeObject > Printer
Allows to print PDF documents or images from the device. A printer object is always available from tabris.printer.
Type: | Printer extends NativeObject |
Constructor: | private |
Singleton: | printer |
Namespace: | tabris |
Direct subclasses: | None |
JSX Support: | No |
Examples
JavaScript
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
Methods
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 | Description |
---|---|---|
data | any |
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 | { |
An optional set of configuration parameters. Optional. |
Returns: Promise