-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
96 lines (94 loc) · 3.25 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import { Injectable } from '@angular/core';
import { Plugin, IonicNativePlugin, Cordova } from '@ionic-native/core';
export interface PrintOptions {
/**
* The name of the print job and the document
*/
name?: string;
/**
* The network URL of the printer.
* Only supported on iOS.
*/
printerId?: string;
/**
* Specifies the duplex mode to use for the print job.
* Either double-sided (duplex:true) or single-sided (duplex:false).
* Double-sided by default.
* Only supported on iOS
*/
duplex?: boolean;
/**
* The orientation of the printed content, portrait or landscape
* Portrait by default.
*/
landscape?: boolean;
/**
* If your application only prints black text, setting this property to true can result in better performance in many cases.
* False by default.
*/
grayscale?: boolean;
/**
* The Size and position of the print view
*/
bounds?: number[] | any;
isTicket: boolean;
comanda: any;
}
/**
* @name Printer
* @description Prints documents or HTML rendered content
* @usage
* ```typescript
* import { Printer, PrintOptions } from '@ionic-native/printer';
*
* constructor(private printer: Printer) { }
*
* ...
*
* this.printer.isAvailable().then(onSuccess, onError);
*
* let options: PrintOptions = {
* name: 'MyDocument',
* printerId: 'printer007',
* duplex: true,
* landscape: true,
* grayscale: true
* };
*
* this.printer.print(content, options).then(onSuccess, onError);
* ```
* @interfaces
// * PrintOptions
*/
@Plugin({
pluginName: 'MyPrinter', // should match the name of the wrapper class
plugin: 'myPrinter', // NPM package name
pluginRef: 'MyPrinter', // name of the object exposed by the plugin
repo: 'https://github.com/jordiigarciaa/myPrinter', // plugin repository URL
platforms: ['Android', 'iOS'] // supported platforms
})
@Injectable()
export declare class MyPrinter extends IonicNativePlugin {
/**
* Checks whether the device is capable of printing (uses `check()` internally)
* @returns {Promise<boolean>}
*/
isAvailable(): Promise<boolean>;
/**
* Checks if the printer service is available (iOS) or if printer services are installed and enabled (Android).
* @return {Promise<any>} returns a promise that resolve with an object indicating whether printing is available, and providing the number of printers available
*/
check(): Promise<any>;
/**
* Displays a system interface allowing the user to select an available printer. To speak with a printer directly you need to know the network address by picking them before via `printer.pick`.
* @returns {Promise<any>}
*/
pick(): Promise<any>;
/**
* Sends content to the printer.
* @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.
* @param options {PrintOptions} optional. The options to pass to the printer
* @returns {Promise<any>}
*/
print(content: string | HTMLElement, options?: PrintOptions): Promise<any>;
}