@xiaoerge/node-printer 0.0.0-stage → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,12 @@
1
+ # simple python command to list files like ls -1
2
+ import os, sys
3
+
4
+ if len(sys.argv) < 3:
5
+ sys.stderr.write('use: '+sys.argv[0]+' <path> <ext>. e.g.:'+sys.argv[0]+' src cc\n')
6
+ sys.exit(1)
7
+ folder = sys.argv[1]
8
+ file_ext = '.'+sys.argv[2]
9
+
10
+ for file in os.listdir(folder):
11
+ if (file.endswith(file_ext)):
12
+ print(folder+'/'+file)
@@ -0,0 +1,79 @@
1
+ export function getPrinters(): PrinterDetails[];
2
+ export function getPrinter(printerName: string): PrinterDetails;
3
+ export function getPrinterDriverOptions(
4
+ printerName: string,
5
+ ): PrinterDriverOptions;
6
+ export function getSelectedPaperSize(printerName: string): string;
7
+ export function getDefaultPrinterName(): string | undefined;
8
+ export function printDirect(options: PrintDirectOptions): void;
9
+ export function printFile(options: PrintFileOptions): void;
10
+ export function getSupportedPrintFormats(): string[];
11
+ export function getJob(printerName: string, jobId: number): JobDetails;
12
+ export function setJob(
13
+ printerName: string,
14
+ jobId: number,
15
+ command: 'CANCEL' | string,
16
+ ): void;
17
+ export function getSupportedJobCommands(): string[];
18
+
19
+ export interface PrintDirectOptions {
20
+ data: string | Buffer;
21
+ printer?: string | undefined;
22
+ type?:
23
+ | 'RAW'
24
+ | 'TEXT'
25
+ | 'PDF'
26
+ | 'JPEG'
27
+ | 'POSTSCRIPT'
28
+ | 'COMMAND'
29
+ | 'AUTO'
30
+ | undefined;
31
+ options?: { [key: string]: string } | undefined;
32
+ success?: PrintOnSuccessFunction | undefined;
33
+ error?: PrintOnErrorFunction | undefined;
34
+ }
35
+
36
+ export interface PrintFileOptions {
37
+ filename: string;
38
+ printer?: string | undefined;
39
+ options?: { [key: string]: string } | undefined;
40
+ success?: PrintOnSuccessFunction | undefined;
41
+ error?: PrintOnErrorFunction | undefined;
42
+ }
43
+
44
+ export type PrintOnSuccessFunction = (jobId: string) => any;
45
+ export type PrintOnErrorFunction = (err: Error) => any;
46
+
47
+ export interface PrinterDetails {
48
+ name: string;
49
+ isDefault: boolean;
50
+ options: { [key: string]: string };
51
+ }
52
+
53
+ export interface PrinterDriverOptions {
54
+ [key: string]: { [key: string]: boolean };
55
+ }
56
+
57
+ export interface JobDetails {
58
+ id: number;
59
+ name: string;
60
+ printerName: string;
61
+ user: string;
62
+ format: string;
63
+ priority: number;
64
+ size: number;
65
+ status: JobStatus[];
66
+ completedTime: Date;
67
+ creationTime: Date;
68
+ processingTime: Date;
69
+ }
70
+
71
+ export type JobStatus =
72
+ | 'PAUSED'
73
+ | 'PRINTING'
74
+ | 'PRINTED'
75
+ | 'CANCELLED'
76
+ | 'PENDING'
77
+ | 'ABORTED';
78
+
79
+ declare module '@niick555/node-printer';