UNPKG

2.06 kBTypeScriptView Raw
1export interface PrintOptions {
2 /**
3 * The name of the print job and the document
4 */
5 name?: string;
6 /**
7 * The network URL of the printer.
8 * Only supported on iOS.
9 */
10 printerId?: string;
11 /**
12 * Specifies the duplex mode to use for the print job.
13 * Either double-sided (duplex:true) or single-sided (duplex:false).
14 * Double-sided by default.
15 * Only supported on iOS
16 */
17 duplex?: boolean;
18 /**
19 * The orientation of the printed content, portrait or landscape
20 * Portrait by default.
21 */
22 landscape?: boolean;
23 /**
24 * If your application only prints black text, setting this property to true can result in better performance in many cases.
25 * False by default.
26 */
27 grayscale?: boolean;
28 /**
29 * The Size and position of the print view
30 */
31 bounds?: number[] | any;
32}
33/**
34 * @name Printer
35 * @description Prints documents or HTML rendered content
36 * @usage
37 * ```typescript
38 * import {Printer, PrintOptions} from 'ionic-native';
39 *
40 * Printer.isAvailable().then(onSuccess, onError);
41 *
42 * let options: PrintOptions = {
43 * name: 'MyDocument',
44 * printerId: 'printer007',
45 * duplex: true,
46 * landscape: true,
47 * grayscale: true
48 * };
49 *
50 * Printer.print(content, options).then(onSuccess, onError);
51 * ```
52 * @interfaces
53 * PrintOptions
54 */
55export declare class Printer {
56 /**
57 * Checks whether to device is capable of printing.
58 * @returns {Promise<boolean>}
59 */
60 static isAvailable(): Promise<boolean>;
61 /**
62 * Sends content to the printer.
63 * @param content {string | HTMLElement} The content to print. Can be a URL or an HTML string. If a HTML DOM Object is provided, its innerHtml property value will be used.
64 * @param options {PrintOptions} optional. The options to pass to the printer
65 * @returns {Promise<any>}
66 */
67 static print(content: string | HTMLElement, options?: PrintOptions): Promise<any>;
68}