• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @ohos.print (Print)
2
3The **print** module provides APIs for basic print operations.
4
5> **NOTE**
6> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
7
8## Modules to Import
9
10```ts
11import { print } from '@kit.BasicServicesKit';
12```
13
14## print.PrintTask
15
16Implements event listeners for print tasks.
17
18### on
19
20on(type: 'block', callback: Callback<void>): void
21
22Registers a listener for the print task blocking event. This API uses a callback to return the result.
23
24**Required permissions**: ohos.permission.PRINT
25
26**System capability**: SystemCapability.Print.PrintFramework
27
28**Parameters**
29| **Name**| **Type**| **Mandatory**| **Description**|
30| -------- | -------- | -------- | -------- |
31| type | string | Yes| Listening type.<br>The value is fixed at **'block'**,<br>indicating blocking of the print task.|
32| callback | Callback&lt;void&gt; | Yes| Callback used to return the result.|
33
34**Error codes**
35
36For details about the error codes, see [Error Codes of the Print Service](./errorcode-print.md).
37
38| ID| Error Message                                   |
39| -------- | ------------------------------------------- |
40| 201 | the application does not have permission to call this function. |
41| 401 | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. |
42
43**Example**
44
45```ts
46import { print } from '@kit.BasicServicesKit';
47import { BusinessError } from '@ohos.base';
48
49let file = ['file://data/print/a.png', 'file://data/print/b.png'];
50print.print(file).then((printTask: print.PrintTask) => {
51    printTask.on('block', () => {
52        console.log('print state is block');
53    })
54    // ...
55}).catch((error: BusinessError) => {
56    console.log('print err ' + JSON.stringify(error));
57})
58```
59
60### on
61
62on(type: 'succeed', callback: Callback&lt;void&gt;): void
63
64Registers a listener for the print task blocking event. This API uses a callback to return the result.
65
66**Required permissions**: ohos.permission.PRINT
67
68**System capability**: SystemCapability.Print.PrintFramework
69
70**Parameters**
71| **Name**| **Type**| **Mandatory**| **Description**|
72| -------- | -------- | -------- | -------- |
73| type | string | Yes| Listening type.<br>The value is fixed at **'succeed'**,<br>indicating success of the print task.|
74| callback | Callback&lt;void&gt; | Yes| Callback used to return the result.|
75
76**Error codes**
77
78For details about the error codes, see [Error Codes of the Print Service](./errorcode-print.md).
79
80| ID| Error Message                                   |
81| -------- | ------------------------------------------- |
82| 201 | the application does not have permission to call this function. |
83| 401 | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. |
84
85**Example**
86
87```ts
88import { print } from '@kit.BasicServicesKit';
89import { BusinessError } from '@ohos.base';
90
91let file = ['file://data/print/a.png', 'file://data/print/b.png'];
92print.print(file).then((printTask: print.PrintTask) => {
93    printTask.on('succeed', () => {
94        console.log('print state is succeed');
95    })
96    // ...
97}).catch((error: BusinessError) => {
98    console.log('print err ' + JSON.stringify(error));
99})
100```
101
102### on
103
104on(type: 'fail', callback: Callback&lt;void&gt;): void
105
106Registers a listener for the print task blocking event. This API uses a callback to return the result.
107
108**Required permissions**: ohos.permission.PRINT
109
110**System capability**: SystemCapability.Print.PrintFramework
111
112**Parameters**
113| **Name**| **Type**| **Mandatory**| **Description**|
114| -------- | -------- | -------- | -------- |
115| type | string | Yes| Listening type.<br>The value is fixed at **'fail'**,<br>indicating failure of the print task.|
116| callback | Callback&lt;void&gt; | Yes| Callback used to return the result.|
117
118**Error codes**
119
120For details about the error codes, see [Error Codes of the Print Service](./errorcode-print.md).
121
122| ID| Error Message                                   |
123| -------- | ------------------------------------------- |
124| 201 | the application does not have permission to call this function. |
125| 401 | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. |
126
127**Example**
128
129```ts
130import { print } from '@kit.BasicServicesKit';
131import { BusinessError } from '@ohos.base';
132
133let file = ['file://data/print/a.png', 'file://data/print/b.png'];
134print.print(file).then((printTask: print.PrintTask) => {
135    printTask.on('fail', () => {
136        console.log('print state is fail');
137    })
138    // ...
139}).catch((error: BusinessError) => {
140    console.log('print err ' + JSON.stringify(error));
141})
142```
143
144### on
145
146on(type: 'cancel', callback: Callback&lt;void&gt;): void
147
148Registers a listener for the print task blocking event. This API uses a callback to return the result.
149
150**Required permissions**: ohos.permission.PRINT
151
152**System capability**: SystemCapability.Print.PrintFramework
153
154**Parameters**
155| **Name**| **Type**| **Mandatory**| **Description**|
156| -------- | -------- | -------- | -------- |
157| type | string | Yes| Listening type.<br>The value is fixed at **'cancel'**,<br>indicating canceling of the print task.|
158| callback | Callback&lt;void&gt; | Yes| Callback used to return the result.|
159
160**Error codes**
161
162For details about the error codes, see [Error Codes of the Print Service](./errorcode-print.md).
163
164| ID| Error Message                                   |
165| -------- | ------------------------------------------- |
166| 201 | the application does not have permission to call this function. |
167| 401 | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. |
168
169**Example**
170
171```ts
172import { print } from '@kit.BasicServicesKit';
173import { BusinessError } from '@ohos.base';
174
175let file = ['file://data/print/a.png', 'file://data/print/b.png'];
176print.print(file).then((printTask: print.PrintTask) => {
177    printTask.on('cancel', () => {
178        console.log('print state is cancel');
179    })
180    // ...
181}).catch((error: BusinessError) => {
182    console.log('print err ' + JSON.stringify(error));
183})
184```
185
186### off
187
188off(type: 'block', callback?: Callback&lt;void&gt;): void
189
190Unregisters the listener for the print task blocking event. This API uses a callback to return the result.
191
192**Required permissions**: ohos.permission.PRINT
193
194**System capability**: SystemCapability.Print.PrintFramework
195
196**Parameters**
197| **Name**| **Type**| **Mandatory**| **Description**|
198| -------- | -------- | -------- | -------- |
199| type | string | Yes| Listening type.<br>The value is fixed at **'block'**,<br>indicating blocking of the print task.|
200| callback | Callback&lt;void&gt; | No| Callback used to return the result.|
201
202**Error codes**
203
204For details about the error codes, see [Error Codes of the Print Service](./errorcode-print.md).
205
206| ID| Error Message                                   |
207| -------- | ------------------------------------------- |
208| 201 | the application does not have permission to call this function. |
209| 401 | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. |
210
211**Example**
212
213```ts
214import { print } from '@kit.BasicServicesKit';
215import { BusinessError } from '@ohos.base';
216
217let file = ['file://data/print/a.png', 'file://data/print/b.png'];
218print.print(file).then((printTask: print.PrintTask) => {
219    printTask.off('block', () => {
220        console.log('unregister state block');
221    })
222    // ...
223}).catch((error: BusinessError) => {
224    console.log('print err ' + JSON.stringify(error));
225})
226```
227
228### off
229
230off(type: 'succeed', callback?: Callback&lt;void&gt;): void
231
232Unregisters the listener for the print task blocking event. This API uses a callback to return the result.
233
234**Required permissions**: ohos.permission.PRINT
235
236**System capability**: SystemCapability.Print.PrintFramework
237
238**Parameters**
239| **Name**| **Type**| **Mandatory**| **Description**|
240| -------- | -------- | -------- | -------- |
241| type | string | Yes| Listening type.<br>The value is fixed at **'succeed'**,<br>indicating success of the print task.|
242| callback | Callback&lt;void&gt; | No| Callback used to return the result.|
243
244**Error codes**
245
246For details about the error codes, see [Error Codes of the Print Service](./errorcode-print.md).
247
248| ID| Error Message                                   |
249| -------- | ------------------------------------------- |
250| 201 | the application does not have permission to call this function. |
251| 401 | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. |
252
253**Example**
254
255```ts
256import { print } from '@kit.BasicServicesKit';
257import { BusinessError } from '@ohos.base';
258
259let file = ['file://data/print/a.png', 'file://data/print/b.png'];
260print.print(file).then((printTask: print.PrintTask) => {
261    printTask.off('succeed', () => {
262        console.log('unregister state succeed');
263    })
264    // ...
265}).catch((error: BusinessError) => {
266    console.log('print err ' + JSON.stringify(error));
267})
268```
269
270### off
271
272off(type: 'fail', callback?: Callback&lt;void&gt;): void
273
274Unregisters the listener for the print task blocking event. This API uses a callback to return the result.
275
276**Required permissions**: ohos.permission.PRINT
277
278**System capability**: SystemCapability.Print.PrintFramework
279
280**Parameters**
281| **Name**| **Type**| **Mandatory**| **Description**|
282| -------- | -------- | -------- | -------- |
283| type | string | Yes| Listening type.<br>The value is fixed at **'fail'**,<br>indicating failure of the print task.|
284| callback | Callback&lt;void&gt; | No| Callback used to return the result.|
285
286**Error codes**
287
288For details about the error codes, see [Error Codes of the Print Service](./errorcode-print.md).
289
290| ID| Error Message                                   |
291| -------- | ------------------------------------------- |
292| 201 | the application does not have permission to call this function. |
293| 401 | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. |
294
295**Example**
296
297```ts
298import { print } from '@kit.BasicServicesKit';
299import { BusinessError } from '@ohos.base';
300
301let file = ['file://data/print/a.png', 'file://data/print/b.png'];
302print.print(file).then((printTask: print.PrintTask) => {
303    printTask.off('fail', () => {
304        console.log('unregister state fail');
305    })
306    // ...
307}).catch((error: BusinessError) => {
308    console.log('print err ' + JSON.stringify(error));
309})
310```
311
312### off
313
314off(type: 'cancel', callback?: Callback&lt;void&gt;): void
315
316Unregisters the listener for the print task blocking event. This API uses a callback to return the result.
317
318**Required permissions**: ohos.permission.PRINT
319
320**System capability**: SystemCapability.Print.PrintFramework
321
322**Parameters**
323| **Name**| **Type**| **Mandatory**| **Description**|
324| -------- | -------- | -------- | -------- |
325| type | string | Yes| Listening type.<br>The value is fixed at **'cancel'**,<br>indicating canceling of the print task.|
326| callback | Callback&lt;void&gt; | No| Callback used to return the result.|
327
328**Error codes**
329
330For details about the error codes, see [Error Codes of the Print Service](./errorcode-print.md).
331
332| ID| Error Message                                   |
333| -------- | ------------------------------------------- |
334| 201 | the application does not have permission to call this function. |
335| 401 | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. |
336
337**Example**
338
339```ts
340import { print } from '@kit.BasicServicesKit';
341import { BusinessError } from '@ohos.base';
342
343let file = ['file://data/print/a.png', 'file://data/print/b.png'];
344print.print(file).then((printTask: print.PrintTask) => {
345    printTask.off('cancel', () => {
346        console.log('unregister state cancel');
347    })
348    // ...
349}).catch((error: BusinessError) => {
350    console.log('print err ' + JSON.stringify(error));
351})
352```
353
354## print.PrintDocumentAdapter<sup>11+</sup>
355
356Provides information about the document to print. This API must be implemented by a third-party application.
357
358### onStartLayoutWrite
359
360onStartLayoutWrite(jobId: string, oldAttrs: PrintAttributes, newAttrs: PrintAttributes, fd: number, writeResultCallback: (jobId: string, writeResult: PrintFileCreationState) => void): void
361
362Sends an empty PDF file descriptor to a third-party application. The third-party application updates the file with the new print attributes and then calls **writeResultCallback** to print the file.
363
364**Required permissions**: ohos.permission.PRINT
365
366**System capability**: SystemCapability.Print.PrintFramework
367
368**Parameters**
369| **Name**| **Type**| **Mandatory**| **Description**|
370| -------- | -------- | -------- | -------- |
371| jobId | string | Yes| ID of the print job.|
372| oldAttrs | [PrintAttributes](#printprintattributes11) | Yes| Old print attributes.|
373| newAttrs | [PrintAttributes](#printprintattributes11) | Yes| New print attributes.|
374| fd | number | Yes| PDF file descriptor sent to the API caller.|
375| writeResultCallback | (jobId: string, writeResult: [PrintFileCreationState](#printprintfilecreationstate11)) | Yes| Callback used to print the updated file.|
376
377**Error codes**
378
379For details about the error codes, see [Error Codes of the Print Service](./errorcode-print.md).
380
381| ID| Error Message                                   |
382| -------- | ------------------------------------------- |
383| 201 | the application does not have permission to call this function. |
384| 401 | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. |
385
386**Example**
387
388```ts
389import { print } from '@kit.BasicServicesKit';
390import { BusinessError } from '@ohos.base';
391
392class MyPrintDocumentAdapter implements print.PrintDocumentAdapter {
393    onStartLayoutWrite(jobId: string, oldAttrs: print.PrintAttributes, newAttrs: print.PrintAttributes, fd: number,
394        writeResultCallback: (jobId: string, writeResult: print.PrintFileCreationState) => void) {
395        writeResultCallback(jobId, print.PrintFileCreationState.PRINT_FILE_CREATED);
396    };
397    onJobStateChanged(jobId: string, state: print.PrintDocumentAdapterState) {
398        if (state == print.PrintDocumentAdapterState.PREVIEW_DESTROY) {
399            console.log('PREVIEW_DESTROY');
400        } else if (state == print.PrintDocumentAdapterState.PRINT_TASK_SUCCEED) {
401            console.log('PRINT_TASK_SUCCEED');
402        } else if (state == print.PrintDocumentAdapterState.PRINT_TASK_FAIL) {
403            console.log('PRINT_TASK_FAIL');
404        } else if (state == print.PrintDocumentAdapterState.PRINT_TASK_CANCEL) {
405            console.log('PRINT_TASK_CANCEL');
406        } else if (state == print.PrintDocumentAdapterState.PRINT_TASK_BLOCK) {
407            console.log('PRINT_TASK_BLOCK');
408        }
409    }
410}
411```
412
413### onJobStateChanged
414
415onJobStateChanged(jobId: string, state: PrintDocumentAdapterState): void
416
417Registers a listener for print job state changes.
418
419**Required permissions**: ohos.permission.PRINT
420
421**System capability**: SystemCapability.Print.PrintFramework
422
423**Parameters**
424| **Name**| **Type**| **Mandatory**| **Description**|
425| -------- | -------- | -------- | -------- |
426| jobId | string | Yes| ID of the print job.|
427| state | [PrintDocumentAdapterState](#printprintdocumentadapterstate11) | Yes| New state of the print job.|
428
429**Error codes**
430
431For details about the error codes, see [Error Codes of the Print Service](./errorcode-print.md).
432
433| ID| Error Message                                   |
434| -------- | ------------------------------------------- |
435| 201 | the application does not have permission to call this function. |
436| 401 | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. |
437
438**Example**
439
440```ts
441import { print } from '@kit.BasicServicesKit';
442import { BusinessError } from '@ohos.base';
443
444class MyPrintDocumentAdapter implements print.PrintDocumentAdapter {
445    onStartLayoutWrite(jobId: string, oldAttrs: print.PrintAttributes, newAttrs: print.PrintAttributes, fd: number,
446        writeResultCallback: (jobId: string, writeResult: print.PrintFileCreationState) => void) {
447        writeResultCallback(jobId, print.PrintFileCreationState.PRINT_FILE_CREATED);
448    };
449    onJobStateChanged(jobId: string, state: print.PrintDocumentAdapterState) {
450        if (state == print.PrintDocumentAdapterState.PREVIEW_DESTROY) {
451            console.log('PREVIEW_DESTROY');
452        } else if (state == print.PrintDocumentAdapterState.PRINT_TASK_SUCCEED) {
453            console.log('PRINT_TASK_SUCCEED');
454        } else if (state == print.PrintDocumentAdapterState.PRINT_TASK_FAIL) {
455            console.log('PRINT_TASK_FAIL');
456        } else if (state == print.PrintDocumentAdapterState.PRINT_TASK_CANCEL) {
457            console.log('PRINT_TASK_CANCEL');
458        } else if (state == print.PrintDocumentAdapterState.PRINT_TASK_BLOCK) {
459            console.log('PRINT_TASK_BLOCK');
460        }
461    }
462}
463```
464
465## print.print
466
467print(files: Array&lt;string&gt;, callback: AsyncCallback&lt;PrintTask&gt;): void
468
469Prints files. This API uses an asynchronous callback to return the result.
470
471**Required permissions**: ohos.permission.PRINT
472
473**System capability**: SystemCapability.Print.PrintFramework
474
475**Parameters**
476| **Name**| **Type**| **Mandatory**| **Description**|
477| -------- | -------- | -------- | -------- |
478| files | Array&lt;string&gt; | Yes| List of files to print. Images (in .jpg, .png, .gif, .bmp, or .webp format) and PDF files are supported. Before a system application passes in the URI, it needs to call **uriPermissionManager.grantUriPermission()** to authorize the print application. This API is a system API. [print](#printprint11-2) is recommended for third-party application.|
479| callback | AsyncCallback&lt;[PrintTask](#printprinttask)&gt; | Yes| Callback used to return the result.|
480
481**Error codes**
482
483For details about the error codes, see [Error Codes of the Print Service](./errorcode-print.md).
484
485| ID| Error Message                                   |
486| -------- | ------------------------------------------- |
487| 201 | the application does not have permission to call this function. |
488| 401 | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. |
489
490**Example**
491
492```ts
493import { print } from '@kit.BasicServicesKit';
494import { BusinessError } from '@ohos.base';
495
496// Pass in the URIs of the files.
497let files = ['file://data/print/a.png', 'file://data/print/b.png'];
498// Alternatively, pass in the fd.
499//let files = ['fd://1', 'fd://2'];
500print.print(files, (err: BusinessError, printTask: print.PrintTask) => {
501    if (err) {
502        console.log('print err ' + JSON.stringify(err));
503    } else {
504        printTask.on('succeed', () => {
505            console.log('print state is succeed');
506        })
507        // ...
508    }
509})
510```
511
512## print.print
513
514print(files: Array&lt;string&gt;): Promise&lt;PrintTask&gt;
515
516Prints files. This API uses a promise to return the result.
517
518**Required permissions**: ohos.permission.PRINT
519
520**System capability**: SystemCapability.Print.PrintFramework
521
522**Parameters**
523| **Name**| **Type**| **Mandatory**| **Description**|
524| -------- | -------- | -------- | -------- |
525| files | Array&lt;string&gt; | Yes| List of files to print. Images (in .jpg, .png, .gif, .bmp, or .webp format) and PDF files are supported. Before a system application passes in the URI, it needs to call **uriPermissionManager.grantUriPermission()** to authorize the print application. This API is a system API. [print](#printprint11-2) is recommended for third-party application.|
526
527**Return value**
528| **Type**| **Description**|
529| -------- | -------- |
530| Promise&lt;[PrintTask](#printprinttask)&gt; | Print result.|
531
532**Error codes**
533
534For details about the error codes, see [Error Codes of the Print Service](./errorcode-print.md).
535
536| ID| Error Message                                   |
537| -------- | ------------------------------------------- |
538| 201 | the application does not have permission to call this function. |
539| 401 | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. |
540
541**Example**
542
543```ts
544import { print } from '@kit.BasicServicesKit';
545import { BusinessError } from '@ohos.base';
546
547// Pass in the URIs of the files.
548let files = ['file://data/print/a.png', 'file://data/print/b.png'];
549// Alternatively, pass in the fd.
550//let files = ['fd://1', 'fd://2'];
551print.print(files).then((printTask: print.PrintTask) => {
552    printTask.on('succeed', () => {
553        console.log('print state is succeed');
554    })
555    // ...
556}).catch((error: BusinessError) => {
557    console.log('print err ' + JSON.stringify(error));
558})
559```
560
561## print.print<sup>11+</sup>
562
563print(files: Array&lt;string&gt;, context: Context, callback: AsyncCallback&lt;PrintTask&gt;): void
564
565Prints files. This API uses an asynchronous callback to return the result.
566
567**Required permissions**: ohos.permission.PRINT
568
569**System capability**: SystemCapability.Print.PrintFramework
570
571**Parameters**
572| **Name**| **Type**| **Mandatory**| **Description**|
573| -------- | -------- | -------- | -------- |
574| files | Array&lt;string&gt; | Yes| List of files to print. Images (in .jpg, .png, .gif, .bmp, or .webp format) and PDF files are supported. Before a system application passes in the URI, it needs to call **uriPermissionManager.grantUriPermission()** to authorize the print application. This API is a system API. [print](#printprint11-2) is recommended for third-party application.|
575| context | Context | Yes| UIAbilityContext used to start the system print UI.|
576| callback | AsyncCallback&lt;[PrintTask](#printprinttask)&gt; | Yes| Callback used to return the result.|
577
578**Error codes**
579
580For details about the error codes, see [Error Codes of the Print Service](./errorcode-print.md).
581
582| ID| Error Message                                   |
583| -------- | ------------------------------------------- |
584| 201 | the application does not have permission to call this function. |
585| 401 | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. |
586
587**Example**
588
589```ts
590import { print } from '@kit.BasicServicesKit';
591import { BusinessError } from '@ohos.base';
592
593// Pass in the URIs of the files.
594let files = ['file://data/print/a.png', 'file://data/print/b.png'];
595// Alternatively, pass in the fd.
596//let files = ['fd://1', 'fd://2'];
597let context = getContext(this);
598print.print(files, context, (err: BusinessError, printTask: print.PrintTask) => {
599    if (err) {
600        console.log('print err ' + JSON.stringify(err));
601    } else {
602        printTask.on('succeed', () => {
603            console.log('print state is succeed');
604        })
605        // ...
606    }
607})
608```
609
610## print.print<sup>11+</sup>
611
612print(files: Array&lt;string&gt;, context: Context): Promise&lt;PrintTask&gt;
613
614Prints files. This API uses a promise to return the result.
615
616**Required permissions**: ohos.permission.PRINT
617
618**System capability**: SystemCapability.Print.PrintFramework
619
620**Parameters**
621| **Name**| **Type**| **Mandatory**| **Description**|
622| -------- | -------- | -------- | -------- |
623| files | Array&lt;string&gt; | Yes| List of files to print. Images (in .jpg, .png, .gif, .bmp, or .webp format) and PDF files are supported. Before a system application passes in the URI, it needs to call **uriPermissionManager.grantUriPermission()** to authorize the print application. This API is a system API. [print](#printprint11-2) is recommended for third-party application.|
624| context | Context | Yes| UIAbilityContext used to start the system print UI.|
625
626**Return value**
627| **Type**| **Description**|
628| -------- | -------- |
629| Promise&lt;[PrintTask](#printprinttask)&gt; | Print result.|
630
631**Error codes**
632
633For details about the error codes, see [Error Codes of the Print Service](./errorcode-print.md).
634
635| ID| Error Message                                   |
636| -------- | ------------------------------------------- |
637| 201 | the application does not have permission to call this function. |
638| 401 | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. |
639
640**Example**
641
642```ts
643import { print } from '@kit.BasicServicesKit';
644import { BusinessError } from '@ohos.base';
645
646// Pass in the URIs of the files.
647let files = ['file://data/print/a.png', 'file://data/print/b.png'];
648// Alternatively, pass in the fd.
649//let files = ['fd://1', 'fd://2'];
650let context = getContext(this);
651print.print(files, context).then((printTask: print.PrintTask) => {
652    printTask.on('succeed', () => {
653        console.log('print state is succeed');
654    })
655    // ...
656}).catch((error: BusinessError) => {
657    console.log('print err ' + JSON.stringify(error));
658})
659```
660
661## print.print<sup>11+</sup>
662
663print(jobName: string, printAdapter: PrintDocumentAdapter, printAttributes: PrintAttributes, context: Context): Promise&lt;PrintTask&gt;
664
665Prints a file. This API uses a promise to return the result.
666
667**Required permissions**: ohos.permission.PRINT
668
669**System capability**: SystemCapability.Print.PrintFramework
670
671**Parameters**
672| **Name**| **Type**| **Mandatory**| **Description**|
673| -------- | -------- | -------- | -------- |
674| jobName | string | Yes| Name of the file to print, for example, **test.pdf**. The printer uses the [onStartLayoutWrite](#onstartlayoutwrite) API to send the **fd** of the empty PDF file to the API caller. The API caller uses the new print attributes to update the file to print.|
675| printAdapter | [PrintDocumentAdapter](#printprintdocumentadapter11) | Yes| [PrintDocumentAdapter](#printprintdocumentadapter11) API instance implemented by a third-party application.|
676| printAttributes | [PrintAttributes](#printprintattributes11) | Yes| Print attributes.|
677| context | Context | Yes| UIAbilityContext used to start the system print UI.|
678
679**Return value**
680| **Type**| **Description**|
681| -------- | -------- |
682| Promise&lt;[PrintTask](#printprinttask)&gt; | Print result.|
683
684**Error codes**
685
686For details about the error codes, see [Error Codes of the Print Service](./errorcode-print.md).
687
688| ID| Error Message                                   |
689| -------- | ------------------------------------------- |
690| 201 | the application does not have permission to call this function. |
691| 401 | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. |
692
693**Example**
694
695```ts
696import { print } from '@kit.BasicServicesKit';
697import { BusinessError } from '@ohos.base';
698
699let jobName : string = "jobName";
700let printAdapter : print.PrintDocumentAdapter | null = null;
701let printAttributes : print.PrintAttributes = {
702    copyNumber: 1,
703    pageRange: {
704        startPage: 0,
705        endPage: 5,
706        pages: []
707    },
708    pageSize: print.PrintPageType.PAGE_ISO_A3,
709    directionMode: print.PrintDirectionMode.DIRECTION_MODE_AUTO,
710    colorMode: print.PrintColorMode.COLOR_MODE_MONOCHROME,
711    duplexMode: print.PrintDuplexMode.DUPLEX_MODE_NONE
712}
713let context = getContext();
714
715print.print(jobName, printAdapter, printAttributes, context).then((printTask: print.PrintTask) => {
716    printTask.on('succeed', () => {
717        console.log('print state is succeed');
718    })
719    // ...
720}).catch((error: BusinessError) => {
721    console.log('print err ' + JSON.stringify(error));
722})
723```
724
725## print.PrintAttributes<sup>11+</sup>
726
727Defines the print attributes.
728
729**System capability**: SystemCapability.Print.PrintFramework
730
731**Attributes**
732| **Name**| **Type**| **Mandatory**| **Description**|
733| -------- | -------- | -------- | -------- |
734| copyNumber | number | No| Number of printed file copies.|
735| pageRange | [PrintPageRange](#printprintpagerange11) | No| Page range of the file to print.|
736| pageSize | [PrintPageSize](#printprintpagesize11) \| [PrintPageType](#printprintpagetype11) | No| Page size of the file to print.|
737| directionMode | [PrintDirectionMode](#printprintdirectionmode11) | No| Print direction mode.|
738| colorMode | [PrintColorMode](#printprintcolormode11) | No| Color mode of the files to print.|
739| duplexMode | [PrintDuplexMode](#printprintduplexmode11) | No| Duplex mode of the files to print.|
740
741## print.PrintPageRange<sup>11+</sup>
742
743Defines the print range.
744
745**System capability**: SystemCapability.Print.PrintFramework
746
747**Attributes**
748| **Name**| **Type**| **Mandatory**| **Description**|
749| -------- | -------- | -------- | -------- |
750| startPage | number | No| Start page.|
751| endPage | number | No| End page.|
752| pages | Array&lt;number&gt; | No| Page range set of the file to print.|
753
754
755## print.PrintPageSize<sup>11+</sup>
756
757Defines the size of the printed page.
758
759**System capability**: SystemCapability.Print.PrintFramework
760
761**Attributes**
762| **Name**| **Type**| **Mandatory**| **Description**|
763| -------- | -------- | -------- | -------- |
764| id | string | Yes| Paper size ID.|
765| name | string | Yes| Paper size name.|
766| width | number | Yes| Page width, in millimeters.|
767| height | number | Yes| Page height, in millimeters.|
768
769
770
771## print.PrintDirectionMode<sup>11+</sup>
772
773Enumerates the print direction modes.
774
775**System capability**: SystemCapability.Print.PrintFramework
776
777| **Name**| **Value**| **Description**|
778| -------- | -------- | -------- |
779| DIRECTION_MODE_AUTO | 0 | Automatic.|
780| DIRECTION_MODE_PORTRAIT | 1 | Portrait mode.|
781| DIRECTION_MODE_LANDSCAPE | 2 | Landscape mode.|
782
783## print.PrintColorMode<sup>11+</sup>
784
785Enumerates the color modes.
786
787**System capability**: SystemCapability.Print.PrintFramework
788
789| **Name**| **Value**| **Description**|
790| -------- | -------- | -------- |
791| COLOR_MODE_MONOCHROME | 0 | Black and white.|
792| COLOR_MODE_COLOR | 1 | Color.|
793
794## print.PrintDuplexMode<sup>11+</sup>
795
796Enumerates the duplex modes.
797
798**System capability**: SystemCapability.Print.PrintFramework
799
800| **Name**| **Value**| **Description**|
801| -------- | -------- | -------- |
802| DUPLEX_MODE_NONE | 0 | Simplex (single-sided).|
803| DUPLEX_MODE_LONG_EDGE | 1 | Duplex (double-sided) with flipping on long edge.|
804| DUPLEX_MODE_SHORT_EDGE | 2 | Duplex (double-sided) with flipping on short edge.|
805
806## print.PrintPageType<sup>11+</sup>
807
808Enumerates the print page types.
809
810**System capability**: SystemCapability.Print.PrintFramework
811
812| **Name**| **Value**| **Description**|
813| -------- | -------- | -------- |
814| PAGE_ISO_A3 | 0 | A3.|
815| PAGE_ISO_A4 | 1 | A4.|
816| PAGE_ISO_A5 | 2 | A5.|
817| PAGE_JIS_B5 | 3 | B5.|
818| PAGE_ISO_C5 | 4 | C5.|
819| PAGE_ISO_DL | 5 | DL.|
820| PAGE_LETTER | 6 | Letter.|
821| PAGE_LEGAL | 7 | Legal.|
822| PAGE_PHOTO_4X6 | 8 | 4 x 6 photo paper.|
823| PAGE_PHOTO_5X7 | 9 | 5 x 7 photo paper.|
824| PAGE_INT_DL_ENVELOPE | 10 | International envelope DL.|
825| PAGE_B_TABLOID | 11 | B Tabloid.|
826
827## print.PrintDocumentAdapterState<sup>11+</sup>
828
829Enumerates the print job states.
830
831**System capability**: SystemCapability.Print.PrintFramework
832
833| **Name**| **Value**| **Description**|
834| -------- | -------- | -------- |
835| PREVIEW_DESTROY | 0 | The preview fails.|
836| PRINT_TASK_SUCCEED | 1 | The print job is successful.|
837| PRINT_TASK_FAIL | 2 | The print job is failed.|
838| PRINT_TASK_CANCEL | 3 | The print job is canceled.|
839| PRINT_TASK_BLOCK | 4 | The print job is blocked.|
840
841## print.PrintFileCreationState<sup>11+</sup>
842
843Enumerates the print file creation status.
844
845**System capability**: SystemCapability.Print.PrintFramework
846
847| **Name**| **Value**| **Description**|
848| -------- | -------- | -------- |
849| PRINT_FILE_CREATED | 0 | The print file is created successfully.|
850| PRINT_FILE_CREATION_FAILED | 1 | The print file fails to be created.|
851| PRINT_FILE_CREATED_UNRENDERED | 2 | The print file is successfully created but not rendered.|
852
853## print.PrinterState<sup>14+</sup>
854
855Enumerates the printer states.
856
857**System capability**: SystemCapability.Print.PrintFramework
858
859| **Name**| **Value**| **Description**|
860| -------- | -------- | -------- |
861| PRINTER_ADDED | 0 | A new printer is added.|
862| PRINTER_REMOVED | 1 | The printer is removed.|
863| PRINTER_CAPABILITY_UPDATED | 2 | The printer is updated.|
864| PRINTER_CONNECTED | 3 | The printer is connected.|
865| PRINTER_DISCONNECTED | 4 | The printer is disconnected.|
866| PRINTER_RUNNING | 5 | The printer is running.|
867
868## print.PrintJobState<sup>14+</sup>
869
870Enumerates the print job states.
871
872**System capability**: SystemCapability.Print.PrintFramework
873
874| **Name**| **Value**| **Description**|
875| -------- | -------- | -------- |
876| PRINT_JOB_PREPARE | 0 | The printer is prepared for the print job.|
877| PRINT_JOB_QUEUED | 1 | The print job is on the print queue of the printer.|
878| PRINT_JOB_RUNNING | 2 | The print job is being executed.|
879| PRINT_JOB_BLOCKED | 3 | The print job is blocked.|
880| PRINT_JOB_COMPLETED | 4 | The print job is complete.|
881
882## print.PrintJobSubState<sup>14+</sup>
883
884Enumerates the print job substates.
885
886**System capability**: SystemCapability.Print.PrintFramework
887
888| **Name**| **Value**| **Description**|
889| -------- | -------- | -------- |
890| PRINT_JOB_COMPLETED_SUCCESS | 0 | The print job is successful.|
891| PRINT_JOB_COMPLETED_FAILED | 1 | The print job is failed.|
892| PRINT_JOB_COMPLETED_CANCELLED | 2 | The print job is canceled by user.|
893| PRINT_JOB_COMPLETED_FILE_CORRUPTED | 3 | The print job is corrupted.|
894| PRINT_JOB_BLOCK_OFFLINE | 4 | The printer is offline.|
895| PRINT_JOB_BLOCK_BUSY | 5 | The printer is occupied by another process.|
896| PRINT_JOB_BLOCK_CANCELLED | 6 | The print job is canceled due to a block.|
897| PRINT_JOB_BLOCK_OUT_OF_PAPER | 7 | The printer is out of paper.|
898| PRINT_JOB_BLOCK_OUT_OF_INK | 8 | The printer is out of ink.|
899| PRINT_JOB_BLOCK_OUT_OF_TONER | 9 | The printer is out of toner.|
900| PRINT_JOB_BLOCK_JAMMED | 10 | The printer is in a paper jam.|
901| PRINT_JOB_BLOCK_DOOR_OPEN | 11 | The printer door is open.|
902| PRINT_JOB_BLOCK_SERVICE_REQUEST | 12 | Print service request.|
903| PRINT_JOB_BLOCK_LOW_ON_INK | 13 | The printer is low on ink.|
904| PRINT_JOB_BLOCK_LOW_ON_TONER | 14 | The printer is low on toner.|
905| PRINT_JOB_BLOCK_REALLY_LOW_ON_INK | 15 | The printer is extremely low on ink.|
906| PRINT_JOB_BLOCK_BAD_CERTIFICATE | 16 | The print certificate is incorrect.|
907| PRINT_JOB_BLOCK_ACCOUNT_ERROR | 18 | There is an error with the printer account.|
908| PRINT_JOB_BLOCK_PRINT_PERMISSION_ERROR | 19 | There is an error with the printer permission.|
909| PRINT_JOB_BLOCK_PRINT_COLOR_PERMISSION_ERROR | 20 | There is an error with the color printing permission.|
910| PRINT_JOB_BLOCK_NETWORK_ERROR | 21 | The printer fails to connect to the network.|
911| PRINT_JOB_BLOCK_SERVER_CONNECTION_ERROR | 22 | The printer fails to connect to the server.|
912| PRINT_JOB_BLOCK_LARGE_FILE_ERROR | 23 | There is an error with a large file printing.|
913| PRINT_JOB_BLOCK_FILE_PARSING_ERROR | 24 | There is an error with file parsing.|
914| PRINT_JOB_BLOCK_SLOW_FILE_CONVERSION | 25 | The file conversion is slow.|
915| PRINT_JOB_RUNNING_UPLOADING_FILES | 26 | The file is uploading.|
916| PRINT_JOB_RUNNING_CONVERTING_FILES | 27 | The file is converting.|
917| PRINT_JOB_BLOCK_UNKNOWN | 99 | There is an unknown error with the printer.|
918
919## print.PrintErrorCode<sup>14+</sup>
920
921Enumerates the print error codes.
922
923**System capability**: SystemCapability.Print.PrintFramework
924
925| **Name**| **Value**| **Description**|
926| -------- | -------- | -------- |
927| E_PRINT_NONE | 0 | No error.|
928| E_PRINT_NO_PERMISSION | 201 | No permission.|
929| E_PRINT_INVALID_PARAMETER | 401 | Invalid parameters.|
930| E_PRINT_GENERIC_FAILURE | 13100001 | Printing failure.|
931| E_PRINT_RPC_FAILURE | 13100002 | RPC failure.|
932| E_PRINT_SERVER_FAILURE | 13100003 | Print service failure.|
933| E_PRINT_INVALID_EXTENSION | 13100004 | Invalid printer extension.|
934| E_PRINT_INVALID_PRINTER | 13100005 | Invalid printer.|
935| E_PRINT_INVALID_PRINT_JOB | 13100006 | Invalid print job.|
936| E_PRINT_FILE_IO | 13100007 | Incorrect file input/output.|
937
938## print.ApplicationEvent<sup>14+</sup>
939
940Enumerates print application events.
941
942**System capability**: SystemCapability.Print.PrintFramework
943
944| **Name**| **Value**| **Description**|
945| -------- | -------- | -------- |
946| APPLICATION_CREATED | 0 | Starts the print application.|
947| APPLICATION_CLOSED_FOR_STARTED | 1 | Closes the print application by clicking **Start**.|
948| APPLICATION_CLOSED_FOR_CANCELED | 2 | Closes the print application by clicking **Cancel**.|
949
950## print.addPrinterToDiscovery<sup>14+</sup>
951
952addPrinterToDiscovery(printerInformation: PrinterInformation): Promise&lt;void&gt;
953
954Adds a printer to the printer discovery list. This API uses a promise to return the result.
955
956**Required permissions**: ohos.permission.PRINT
957
958**System capability**: SystemCapability.Print.PrintFramework
959
960**Parameters**
961| **Name**| **Type**| **Mandatory**| **Description**|
962| -------- | -------- | -------- | -------- |
963| printerInformation | [PrinterInformation](#printprinterinformation14) | Yes| The added printer.|
964
965**Return value**
966| **Type**| **Description**|
967| -------- | -------- |
968| Promise&lt;void&gt; | Result of adding a printer to the printer discovery list.|
969
970**Error codes**
971
972For details about the error codes, see [Error Codes of the Print Service](./errorcode-print.md).
973
974| ID| Error Message                                   |
975| -------- | ------------------------------------------- |
976| 201 | the application does not have permission to call this function. |
977| 401 | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. |
978
979**Example**
980
981```ts
982import { print } from '@kit.BasicServicesKit';
983import { BusinessError } from '@ohos.base';
984
985let printerInformation : print.PrinterInformation = {
986    printerId : 'testPrinterId',
987    printerName : 'testPrinterName',
988    printerStatus : 0,
989    description : 'testDesc',
990    uri : 'testUri',
991    printerMake : 'testPrinterMake',
992    options : 'testOps'
993};
994print.addPrinterToDiscovery(printerInformation).then((data : void) => {
995    console.log('addPrinterToDiscovery data : ' + JSON.stringify(data));
996}).catch((error: BusinessError) => {
997    console.log('addPrinterToDiscovery error : ' + JSON.stringify(error));
998})
999```
1000
1001## print.updatePrinterInDiscovery<sup>14+</sup>
1002
1003updatePrinterInDiscovery(printerInformation: PrinterInformation): Promise&lt;void&gt;
1004
1005Updates the printer capabilities to the printer discovery list. This API uses a promise to return the result.
1006
1007**Required permissions**: ohos.permission.PRINT
1008
1009**System capability**: SystemCapability.Print.PrintFramework
1010
1011**Parameters**
1012| **Name**| **Type**| **Mandatory**| **Description**|
1013| -------- | -------- | -------- | -------- |
1014| printerInformation | [PrinterInformation](#printprinterinformation14) | Yes| Printer whose capability is to be updated.|
1015
1016**Return value**
1017| **Type**| **Description**|
1018| -------- | -------- |
1019| Promise&lt;void&gt; | Result of updating the printer capabilities to the printer discovery list.|
1020
1021**Error codes**
1022
1023For details about the error codes, see [Error Codes of the Print Service](./errorcode-print.md).
1024
1025| ID| Error Message                                   |
1026| -------- | ------------------------------------------- |
1027| 201 | the application does not have permission to call this function. |
1028| 401 | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. |
1029
1030**Example**
1031
1032```ts
1033import { print } from '@kit.BasicServicesKit';
1034import { BusinessError } from '@ohos.base';
1035
1036let testPageSize : print.PrintPageSize = {
1037    id : 'ISO_A4',
1038    name : 'iso_a4_210x297mm',
1039    width : 8268,
1040    height : 11692
1041};
1042
1043let testCapability : print.PrinterCapabilities = {
1044    supportedPageSizes : [testPageSize],
1045    supportedColorModes : [print.PrintColorMode.COLOR_MODE_MONOCHROME],
1046    supportedDuplexModes : [print.PrintDuplexMode.DUPLEX_MODE_NONE],
1047    supportedMediaTypes : ['stationery'],
1048    supportedQualities : [print.PrintQuality.QUALITY_NORMAL],
1049    supportedOrientations : [print.PrintOrientationMode.ORIENTATION_MODE_PORTRAIT],
1050    options : 'testOptions'
1051};
1052
1053let printerInformation : print.PrinterInformation = {
1054    printerId : 'testPrinterId',
1055    printerName : 'testPrinterName',
1056    printerStatus : 0,
1057    description : 'testDesc',
1058    capability : testCapability,
1059    uri : 'testUri',
1060    printerMake : 'testPrinterMake',
1061    options : 'testOptions'
1062};
1063print.updatePrinterInDiscovery(printerInformation).then((data : void) => {
1064    console.log('updatePrinterInDiscovery data : ' + JSON.stringify(data));
1065}).catch((error: BusinessError) => {
1066    console.log('updatePrinterInDiscovery error : ' + JSON.stringify(error));
1067})
1068```
1069
1070## print.removePrinterFromDiscovery<sup>14+</sup>
1071
1072removePrinterFromDiscovery(printerId: string): Promise&lt;void&gt;
1073
1074Removes a printer from the printer discovery list. This API uses a promise to return the result.
1075
1076**Required permissions**: ohos.permission.PRINT
1077
1078**System capability**: SystemCapability.Print.PrintFramework
1079
1080**Parameters**
1081| **Name**| **Type**| **Mandatory**| **Description**|
1082| -------- | -------- | -------- | -------- |
1083| printerId | string | Yes| Printer to remove.|
1084
1085**Return value**
1086| **Type**| **Description**|
1087| -------- | -------- |
1088| Promise&lt;void&gt; | Result of removing a printer from the printer discovery list.|
1089
1090**Error codes**
1091
1092For details about the error codes, see [Error Codes of the Print Service](./errorcode-print.md).
1093
1094| ID| Error Message                                   |
1095| -------- | ------------------------------------------- |
1096| 201 | the application does not have permission to call this function. |
1097| 401 | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. |
1098
1099**Example**
1100
1101```ts
1102import { print } from '@kit.BasicServicesKit';
1103import { BusinessError } from '@ohos.base';
1104
1105let printerId : string = 'testPrinterId';
1106print.removePrinterFromDiscovery(printerId).then((data : void) => {
1107    console.log('removePrinterFromDiscovery data : ' + JSON.stringify(data));
1108}).catch((error: BusinessError) => {
1109    console.log('removePrinterFromDiscovery error : ' + JSON.stringify(error));
1110})
1111```
1112
1113## print.getPrinterInformationById<sup>14+</sup>
1114
1115getPrinterInformationById(printerId: string): Promise&lt;PrinterInformation&gt;
1116
1117Obtains printer information based on the printer ID. This API uses a promise to return the result.
1118
1119**Required permissions**: ohos.permission.PRINT
1120
1121**System capability**: SystemCapability.Print.PrintFramework
1122
1123**Parameters**
1124| **Name**| **Type**| **Mandatory**| **Description**|
1125| -------- | -------- | -------- | -------- |
1126| printerId | string | Yes| Printer ID used to obtain information.|
1127
1128**Return value**
1129| **Type**| **Description**|
1130| -------- | -------- |
1131| Promise&lt;[PrinterInformation](#printprinterinformation14)&gt; | Printer information obtained based on the printer ID.|
1132
1133**Error codes**
1134
1135For details about the error codes, see [Error Codes of the Print Service](./errorcode-print.md).
1136
1137| ID| Error Message                                   |
1138| -------- | ------------------------------------------- |
1139| 201 | the application does not have permission to call this function. |
1140| 401 | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. |
1141
1142**Example**
1143
1144```ts
1145import { print } from '@kit.BasicServicesKit';
1146import { BusinessError } from '@ohos.base';
1147
1148let printerId : string = 'testPrinterId';
1149print.getPrinterInformationById(printerId).then((printerInformation : print.PrinterInformation) => {
1150    console.log('getPrinterInformationById data : ' + JSON.stringify(printerInformation));
1151}).catch((error: BusinessError) => {
1152    console.log('getPrinterInformationById error : ' + JSON.stringify(error));
1153})
1154```
1155
1156## print.PrinterInformation<sup>14+</sup>
1157
1158Defines the printer information.
1159
1160**System capability**: SystemCapability.Print.PrintFramework
1161
1162**Attributes**
1163| **Name**| **Type**| **Mandatory**| **Description**|
1164| -------- | -------- | -------- | -------- |
1165| printerId | string | Yes| Printer ID.|
1166| printerName | string | Yes| Printer name.|
1167| printerStatus | [PrinterStatus](#printprinterstatus14) | Yes| Printer state.|
1168| description | string | No| Printer description.|
1169| capability | [PrinterCapabilities](#printprintercapabilities14) | No| Printer capabilities.|
1170| uri | string | No| Printer URI.|
1171| printerMake | string | No| Printer model.|
1172| options | string | No| Printer details.|
1173
1174## print.PrinterCapabilities<sup>14+</sup>
1175
1176Defines the printer capabilities.
1177
1178**System capability**: SystemCapability.Print.PrintFramework
1179
1180**Attributes**
1181| **Name**| **Type**| **Mandatory**| **Description**|
1182| -------- | -------- | -------- | -------- |
1183| supportedPageSizes | Array&lt;[PrintPageSize](#printprintpagesize11)&gt; | Yes| List of paper sizes supported by the printer.|
1184| supportedColorModes | Array&lt;[PrintColorMode](#printprintcolormode11)&gt; | Yes| List of color modes supported by the printer.|
1185| supportedDuplexModes | Array&lt;[PrintDuplexMode](#printprintduplexmode11)&gt; | Yes| List of single- and double-sided modes supported by the printer.|
1186| supportedMediaTypes | Array&lt;string&gt; | No| List of paper types supported by the printer.|
1187| supportedQualities | Array&lt;[PrintQuality](#printprintquality14)&gt; | No| List of print quality supported by the printer.|
1188| supportedOrientations | Array&lt;[PrintOrientationMode](#printprintorientationmode14)&gt; | No| List of print directions supported by the printer.|
1189| options | string | No| Printer capability details.|
1190
1191## print.PrintQuality<sup>14+</sup>
1192
1193Enumerates the print qualities.
1194
1195**System capability**: SystemCapability.Print.PrintFramework
1196
1197| **Name**| **Value**| **Description**|
1198| -------- | -------- | -------- |
1199| QUALITY_DRAFT | 3 | Draft|
1200| QUALITY_NORMAL | 4 | Standard|
1201| QUALITY_HIGH | 5 | High|
1202
1203## print.PrintOrientationMode<sup>14+</sup>
1204
1205Enumerates the print directions.
1206
1207**System capability**: SystemCapability.Print.PrintFramework
1208
1209| **Name**| **Value**| **Description**|
1210| -------- | -------- | -------- |
1211| ORIENTATION_MODE_PORTRAIT | 0 | Portrait mode.|
1212| ORIENTATION_MODE_LANDSCAPE | 1 | Landscape mode.|
1213| ORIENTATION_MODE_REVERSE_LANDSCAPE | 2 | Reverse landscape mode.|
1214| ORIENTATION_MODE_REVERSE_PORTRAIT | 3 | Reverse portrait mode.|
1215| ORIENTATION_MODE_NONE | 4 | Adaptive mode.|
1216
1217## print.PrinterStatus<sup>14+</sup>
1218
1219Enumerates the printer states.
1220
1221**System capability**: SystemCapability.Print.PrintFramework
1222
1223| **Name**| **Value**| **Description**|
1224| -------- | -------- | -------- |
1225| PRINTER_IDLE | 0 | The printer is idle.|
1226| PRINTER_BUSY | 1 | The printer is busy.|
1227| PRINTER_UNAVAILABLE | 2 | The printer is unavailable.|
1228