• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @ohos.print (Print)
2
3The **print** module provides APIs for basic print operations.
4
5> **NOTE**
6>
7> 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.
8
9## Modules to Import
10
11```ts
12import print from '@ohos.print';
13```
14
15## PrintTask
16
17Implements event listeners for print tasks.
18
19### on
20
21on(type: 'block', callback: Callback<void>): void
22
23Registers a listener for the print task blocking event. This API uses a callback to return the result.
24
25**Required permissions**: ohos.permission.PRINT
26
27**System capability**: SystemCapability.Print.PrintFramework
28
29**Parameters**
30| **Name**| **Type**| **Mandatory**| **Description**|
31| -------- | -------- | -------- | -------- |
32| type | string | Yes| Listening type.<br>The value is fixed at **'block'**, indicating blocking of the print task.|
33| callback | Callback&lt;void&gt; | Yes| Callback used to return the result.|
34
35**Example**
36
37```ts
38import print from '@ohos.print';
39import { BusinessError } from '@ohos.base';
40
41let file = ['file://data/print/a.png', 'file://data/print/b.png'];
42print.print(file).then((printTask: print.PrintTask) => {
43    printTask.on('block', () => {
44        console.log('print state is block');
45    })
46    // ...
47}).catch((error: BusinessError) => {
48    console.log('print err ' + JSON.stringify(error));
49})
50```
51
52### on
53
54on(type: 'succeed', callback: Callback&lt;void&gt;): void
55
56Registers a listener for the print task success event. This API uses a callback to return the result.
57
58**Required permissions**: ohos.permission.PRINT
59
60**System capability**: SystemCapability.Print.PrintFramework
61
62**Parameters**
63| **Name**| **Type**| **Mandatory**| **Description**|
64| -------- | -------- | -------- | -------- |
65| type | string | Yes| Listening type.<br>The value is fixed at **'succeed'**, indicating success of the print task.|
66| callback | Callback&lt;void&gt; | Yes| Callback used to return the result.|
67
68**Example**
69
70```ts
71import print from '@ohos.print';
72import { BusinessError } from '@ohos.base';
73
74let file = ['file://data/print/a.png', 'file://data/print/b.png'];
75print.print(file).then((printTask: print.PrintTask) => {
76    printTask.on('succeed', () => {
77        console.log('print state is succeed');
78    })
79    // ...
80}).catch((error: BusinessError) => {
81    console.log('print err ' + JSON.stringify(error));
82})
83```
84
85### on
86
87on(type: 'fail', callback: Callback&lt;void&gt;): void
88
89Registers a listener for the print task failure event. This API uses a callback to return the result.
90
91**Required permissions**: ohos.permission.PRINT
92
93**System capability**: SystemCapability.Print.PrintFramework
94
95**Parameters**
96| **Name**| **Type**| **Mandatory**| **Description**|
97| -------- | -------- | -------- | -------- |
98| type | string | Yes| Listening type.<br>The value is fixed at **'fail'**, indicating failure of the print task.|
99| callback | Callback&lt;void&gt; | Yes| Callback used to return the result.|
100
101**Example**
102
103```ts
104import print from '@ohos.print';
105import { BusinessError } from '@ohos.base';
106
107let file = ['file://data/print/a.png', 'file://data/print/b.png'];
108print.print(file).then((printTask: print.PrintTask) => {
109    printTask.on('fail', () => {
110        console.log('print state is fail');
111    })
112    // ...
113}).catch((error: BusinessError) => {
114    console.log('print err ' + JSON.stringify(error));
115})
116```
117
118### on
119
120on(type: 'cancel', callback: Callback&lt;void&gt;): void
121
122Registers a listener for the print task cancel event. This API uses a callback to return the result.
123
124**Required permissions**: ohos.permission.PRINT
125
126**System capability**: SystemCapability.Print.PrintFramework
127
128**Parameters**
129| **Name**| **Type**| **Mandatory**| **Description**|
130| -------- | -------- | -------- | -------- |
131| type | string | Yes| Listening type.<br>The value is fixed at **'cancel'**, indicating canceling of the print task.|
132| callback | Callback&lt;void&gt; | Yes| Callback used to return the result.|
133
134**Example**
135
136```ts
137import print from '@ohos.print';
138import { BusinessError } from '@ohos.base';
139
140let file = ['file://data/print/a.png', 'file://data/print/b.png'];
141print.print(file).then((printTask: print.PrintTask) => {
142    printTask.on('cancel', () => {
143        console.log('print state is cancel');
144    })
145    // ...
146}).catch((error: BusinessError) => {
147    console.log('print err ' + JSON.stringify(error));
148})
149```
150
151### off
152
153off(type: 'block', callback?: Callback&lt;void&gt;): void
154
155Unregisters the listener for the print task blocking event. This API uses a callback to return the result.
156
157**Required permissions**: ohos.permission.PRINT
158
159**System capability**: SystemCapability.Print.PrintFramework
160
161**Parameters**
162| **Name**| **Type**| **Mandatory**| **Description**|
163| -------- | -------- | -------- | -------- |
164| type | string | Yes| Listening type.<br>The value is fixed at **'block'**, indicating blocking of the print task.|
165| callback | Callback&lt;void&gt; | No| Callback used to return the result.|
166
167**Example**
168
169```ts
170import print from '@ohos.print';
171import { BusinessError } from '@ohos.base';
172
173let file = ['file://data/print/a.png', 'file://data/print/b.png'];
174print.print(file).then((printTask: print.PrintTask) => {
175    printTask.off('block', () => {
176        console.log('unregister state block');
177    })
178    // ...
179}).catch((error: BusinessError) => {
180    console.log('print err ' + JSON.stringify(error));
181})
182```
183
184### off
185
186off(type: 'succeed', callback?: Callback&lt;void&gt;): void
187
188Unregisters the listener for the print task success event. This API uses a callback to return the result.
189
190**Required permissions**: ohos.permission.PRINT
191
192**System capability**: SystemCapability.Print.PrintFramework
193
194**Parameters**
195| **Name**| **Type**| **Mandatory**| **Description**|
196| -------- | -------- | -------- | -------- |
197| type | string | Yes| Listening type.<br>The value is fixed at **'succeed'**, indicating success of the print task.|
198| callback | Callback&lt;void&gt; | No| Callback used to return the result.|
199
200**Example**
201
202```ts
203import print from '@ohos.print';
204import { BusinessError } from '@ohos.base';
205
206let file = ['file://data/print/a.png', 'file://data/print/b.png'];
207print.print(file).then((printTask: print.PrintTask) => {
208    printTask.off('succeed', () => {
209        console.log('unregister state succeed');
210    })
211    // ...
212}).catch((error: BusinessError) => {
213    console.log('print err ' + JSON.stringify(error));
214})
215```
216
217### off
218
219off(type: 'fail', callback?: Callback&lt;void&gt;): void
220
221Unregisters the listener for the print task failure event. This API uses a callback to return the result.
222
223**Required permissions**: ohos.permission.PRINT
224
225**System capability**: SystemCapability.Print.PrintFramework
226
227**Parameters**
228| **Name**| **Type**| **Mandatory**| **Description**|
229| -------- | -------- | -------- | -------- |
230| type | string | Yes| Listening type.<br>The value is fixed at **'fail'**, indicating failure of the print task.|
231| callback | Callback&lt;void&gt; | No| Callback used to return the result.|
232
233**Example**
234
235```ts
236import print from '@ohos.print';
237import { BusinessError } from '@ohos.base';
238
239let file = ['file://data/print/a.png', 'file://data/print/b.png'];
240print.print(file).then((printTask: print.PrintTask) => {
241    printTask.off('fail', () => {
242        console.log('unregister state fail');
243    })
244    // ...
245}).catch((error: BusinessError) => {
246    console.log('print err ' + JSON.stringify(error));
247})
248```
249
250### off
251
252off(type: 'cancel', callback?: Callback&lt;void&gt;): void
253
254Unregisters the listener for the print task cancel event. This API uses a callback to return the result.
255
256**Required permissions**: ohos.permission.PRINT
257
258**System capability**: SystemCapability.Print.PrintFramework
259
260**Parameters**
261| **Name**| **Type**| **Mandatory**| **Description**|
262| -------- | -------- | -------- | -------- |
263| type | string | Yes| Listening type.<br>The value is fixed at **'cancel'**, indicating canceling of the print task.|
264| callback | Callback&lt;void&gt; | No| Callback used to return the result.|
265
266**Example**
267
268```ts
269import print from '@ohos.print';
270import { BusinessError } from '@ohos.base';
271
272let file = ['file://data/print/a.png', 'file://data/print/b.png'];
273print.print(file).then((printTask: print.PrintTask) => {
274    printTask.off('cancel', () => {
275        console.log('unregister state cancel');
276    })
277    // ...
278}).catch((error: BusinessError) => {
279    console.log('print err ' + JSON.stringify(error));
280})
281```
282
283## PrintDocumentAdapter<sup>11+</sup>
284
285Provides information about the document to print. This API must be implemented by a third-party application.
286
287### onStartLayoutWrite
288
289onStartLayoutWrite(jobId: string, oldAttrs: PrintAttributes, newAttrs: PrintAttributes, fd: number, writeResultCallback: (jobId: string, writeResult: PrintFileCreationState) => void): void
290
291Updates the file to be printed. This API uses **writeResultCallback** as the callback.
292
293**Required permissions**: ohos.permission.PRINT
294
295**System capability**: SystemCapability.Print.PrintFramework
296
297**Parameters**
298| **Name**| **Type**| **Mandatory**| **Description**|
299| -------- | -------- | -------- | -------- |
300| jobId | string | Yes| ID of the print job.|
301| oldAttrs | PrintAttributes | Yes| Old print attributes.|
302| newAttrs | PrintAttributes | Yes| New print attributes.|
303| fd | number | Yes| File descriptor.|
304| writeResultCallback | (jobId: string, writeResult: PrintFileCreationState) | Yes| Callback used to return the result.|
305
306**Example**
307
308```ts
309import print from '@ohos.print';
310import { BusinessError } from '@ohos.base';
311
312class MyPrintDocumentAdapter implements print.PrintDocumentAdapter {
313    onStartLayoutWrite(jobId: string, oldAttrs: print.PrintAttributes, newAttrs: print.PrintAttributes, fd: number,
314        writeResultCallback: (jobId: string, writeResult: print.PrintFileCreationState) => void) {
315        writeResultCallback(jobId, print.PrintFileCreationState.PRINT_FILE_CREATED);
316    };
317    onJobStateChanged(jobId: string, state: print.PrintDocumentAdapterState) {
318        if (state == print.PrintDocumentAdapterState.PREVIEW_DESTROY) {
319            console.log('PREVIEW_DESTROY');
320        } else if (state == print.PrintDocumentAdapterState.PRINT_TASK_SUCCEED) {
321            console.log('PRINT_TASK_SUCCEED');
322        } else if (state == print.PrintDocumentAdapterState.PRINT_TASK_FAIL) {
323            console.log('PRINT_TASK_FAIL');
324        } else if (state == print.PrintDocumentAdapterState.PRINT_TASK_CANCEL) {
325            console.log('PRINT_TASK_CANCEL');
326        } else if (state == print.PrintDocumentAdapterState.PRINT_TASK_BLOCK) {
327            console.log('PRINT_TASK_BLOCK');
328        }
329    }
330}
331```
332
333### onJobStateChanged
334
335onJobStateChanged(jobId: string, state: PrintDocumentAdapterState): void
336
337Registers a listener for print job state changes.
338
339**Required permissions**: ohos.permission.PRINT
340
341**System capability**: SystemCapability.Print.PrintFramework
342
343**Parameters**
344| **Name**| **Type**| **Mandatory**| **Description**|
345| -------- | -------- | -------- | -------- |
346| jobId | string | Yes| ID of the print job.|
347| state | PrintDocumentAdapterState | Yes| New state of the print job.|
348
349**Example**
350
351```ts
352import print from '@ohos.print';
353import { BusinessError } from '@ohos.base';
354
355class MyPrintDocumentAdapter implements print.PrintDocumentAdapter {
356    onStartLayoutWrite(jobId: string, oldAttrs: print.PrintAttributes, newAttrs: print.PrintAttributes, fd: number,
357        writeResultCallback: (jobId: string, writeResult: print.PrintFileCreationState) => void) {
358        writeResultCallback(jobId, print.PrintFileCreationState.PRINT_FILE_CREATED);
359    };
360    onJobStateChanged(jobId: string, state: print.PrintDocumentAdapterState) {
361        if (state == print.PrintDocumentAdapterState.PREVIEW_DESTROY) {
362            console.log('PREVIEW_DESTROY');
363        } else if (state == print.PrintDocumentAdapterState.PRINT_TASK_SUCCEED) {
364            console.log('PRINT_TASK_SUCCEED');
365        } else if (state == print.PrintDocumentAdapterState.PRINT_TASK_FAIL) {
366            console.log('PRINT_TASK_FAIL');
367        } else if (state == print.PrintDocumentAdapterState.PRINT_TASK_CANCEL) {
368            console.log('PRINT_TASK_CANCEL');
369        } else if (state == print.PrintDocumentAdapterState.PRINT_TASK_BLOCK) {
370            console.log('PRINT_TASK_BLOCK');
371        }
372    }
373}
374```
375
376## print
377
378print(files: Array&lt;string&gt;, callback: AsyncCallback&lt;PrintTask&gt;): void
379
380Prints files. This API uses an asynchronous callback to return the result.
381
382**Required permissions**: ohos.permission.PRINT
383
384**System capability**: SystemCapability.Print.PrintFramework
385
386**Parameters**
387| **Name**| **Type**| **Mandatory**| **Description**|
388| -------- | -------- | -------- | -------- |
389| file | Array&lt;string&gt; | Yes| List of files to print. Images in .jpg, .png, .gif, .bmp, or .webp format are supported.|
390| callback | AsyncCallback&lt;PrintTask&gt; | Yes| Callback used to return the result.|
391
392**Example**
393
394```ts
395import print from '@ohos.print';
396import { BusinessError } from '@ohos.base';
397
398// Pass in the URIs of the files.
399let file = ['file://data/print/a.png', 'file://data/print/b.png'];
400// Alternatively, pass in the file IDs.
401//let file = ['fd://1', 'fd://2'];
402print.print(file, (err: BusinessError, printTask: print.PrintTask) => {
403    if (err) {
404        console.log('print err ' + JSON.stringify(err));
405    } else {
406        printTask.on('succeed', () => {
407            console.log('print state is succeed');
408        })
409        // ...
410    }
411})
412```
413
414## print
415
416print(files: Array&lt;string&gt;): Promise&lt;PrintTask&gt;
417
418Prints files. This API uses a promise to return the result.
419
420**Required permissions**: ohos.permission.PRINT
421
422**System capability**: SystemCapability.Print.PrintFramework
423
424**Parameters**
425| **Name**| **Type**| **Mandatory**| **Description**|
426| -------- | -------- | -------- | -------- |
427| file | Array&lt;string&gt; | Yes| List of files to print. Images in .jpg, .png, .gif, .bmp, or .webp format are supported.|
428
429**Return value**
430| **Type**| **Description**|
431| -------- | -------- |
432| Promise&lt;PrintTask&gt; | Print result.|
433
434**Example**
435
436```ts
437import print from '@ohos.print';
438import { BusinessError } from '@ohos.base';
439
440// Pass in the URIs of the files.
441let file = ['file://data/print/a.png', 'file://data/print/b.png'];
442// Alternatively, pass in the file IDs.
443//let file = ['fd://1', 'fd://2'];
444print.print(file).then((printTask: print.PrintTask) => {
445    printTask.on('succeed', () => {
446        console.log('print state is succeed');
447    })
448    // ...
449}).catch((error: BusinessError) => {
450    console.log('print err ' + JSON.stringify(error));
451})
452```
453
454## print<sup>11+</sup>
455
456print(files: Array&lt;string&gt;, context: Context, callback: AsyncCallback&lt;PrintTask&gt;): void
457
458Prints files. This API uses an asynchronous callback to return the result.
459
460**Required permissions**: ohos.permission.PRINT
461
462**System capability**: SystemCapability.Print.PrintFramework
463
464**Parameters**
465| **Name**| **Type**| **Mandatory**| **Description**|
466| -------- | -------- | -------- | -------- |
467| file | Array&lt;string&gt; | Yes| List of files to print. Images in .jpg, .png, .gif, .bmp, or .webp format are supported.|
468| context | Context | Yes| UIAbility context used to start printing.|
469| callback | AsyncCallback&lt;PrintTask&gt; | Yes| Callback used to return the result.|
470
471**Example**
472
473```ts
474import print from '@ohos.print';
475import { BusinessError } from '@ohos.base';
476
477// Pass in the URIs of the files.
478let file = ['file://data/print/a.png', 'file://data/print/b.png'];
479// Alternatively, pass in the file IDs.
480//let file = ['fd://1', 'fd://2'];
481let context = getContext(this);
482print.print(file, context, (err: BusinessError, printTask: print.PrintTask) => {
483    if (err) {
484        console.log('print err ' + JSON.stringify(err));
485    } else {
486        printTask.on('succeed', () => {
487            console.log('print state is succeed');
488        })
489        // ...
490    }
491})
492```
493
494## print<sup>11+</sup>
495
496print(files: Array&lt;string&gt;, context: Context): Promise&lt;PrintTask&gt;
497
498Prints files. This API uses a promise to return the result.
499
500**Required permissions**: ohos.permission.PRINT
501
502**System capability**: SystemCapability.Print.PrintFramework
503
504**Parameters**
505| **Name**| **Type**| **Mandatory**| **Description**|
506| -------- | -------- | -------- | -------- |
507| file | Array&lt;string&gt; | Yes| List of files to print. Images in .jpg, .png, .gif, .bmp, or .webp format are supported.|
508| context | Context | Yes| UIAbility context used to start printing.|
509
510**Return value**
511| **Type**| **Description**|
512| -------- | -------- |
513| Promise&lt;PrintTask&gt; | Print result.|
514
515**Example**
516
517```ts
518import print from '@ohos.print';
519import { BusinessError } from '@ohos.base';
520
521// Pass in the URIs of the files.
522let file = ['file://data/print/a.png', 'file://data/print/b.png'];
523// Alternatively, pass in the file IDs.
524//let file = ['fd://1', 'fd://2'];
525let context = getContext(this);
526print.print(file, context).then((printTask: print.PrintTask) => {
527    printTask.on('succeed', () => {
528        console.log('print state is succeed');
529    })
530    // ...
531}).catch((error: BusinessError) => {
532    console.log('print err ' + JSON.stringify(error));
533})
534```
535
536## print<sup>11+</sup>
537
538print(jobName: string, printAdapter: PrintDocumentAdapter, printAttributes: PrintAttributes, context: Context): Promise&lt;PrintTask&gt;
539
540Prints a file. This API uses a promise to return the result.
541
542**Required permissions**: ohos.permission.PRINT
543
544**System capability**: SystemCapability.Print.PrintFramework
545
546**Parameters**
547| **Name**| **Type**| **Mandatory**| **Description**|
548| -------- | -------- | -------- | -------- |
549| jobName | string | Yes| Name of the file to print.|
550| printAdapter | PrintDocumentAdapter | Yes| Feature implemented by a third-party application.|
551| printAttributes | PrintAttributes | Yes| Print attributes.|
552| context | Context | Yes| UIAbility context used to start printing.|
553
554**Return value**
555| **Type**| **Description**|
556| -------- | -------- |
557| Promise&lt;PrintTask&gt; | Print result.|
558
559**Example**
560
561```ts
562import print from '@ohos.print';
563import { BusinessError } from '@ohos.base';
564
565let jobName : string = "jobName";
566let printAdapter : print.PrintDocumentAdapter | null = null;
567let printAttributes : print.PrintAttributes = {
568    copyNumber: 1,
569    pageRange: {
570        startPage: 0,
571        endPage: 5,
572        pages: []
573    },
574    pageSize: print.PrintPageType.PAGE_ISO_A3,
575    directionMode: print.PrintDirectionMode.DIRECTION_MODE_AUTO,
576    colorMode: print.PrintColorMode.COLOR_MODE_MONOCHROME,
577    duplexMode: print.PrintDuplexMode.DUPLEX_MODE_NONE
578}
579let context = getContext();
580
581print.print(jobName, printAdapter, printAttributes, context).then((printTask: print.PrintTask) => {
582    printTask.on('succeed', () => {
583        console.log('print state is succeed');
584    })
585    // ...
586}).catch((error: BusinessError) => {
587    console.log('print err ' + JSON.stringify(error));
588})
589```
590
591## PrintAttributes<sup>11+</sup>
592
593Defines the print attributes.
594
595**System capability**: SystemCapability.Print.PrintFramework
596
597**Attributes**
598| **Name**| **Type**| **Mandatory**| **Description**|
599| -------- | -------- | -------- | -------- |
600| copyNumber | number | No| Copy of the file list.|
601| pageRange | PrintPageRange | No| Range of pages to print.|
602| pageSize | PrintPageSize \| PrintPageType | No| Page size of the files to print.|
603| directionMode | PrintDirectionMode | No| Print direction mode.|
604| colorMode | PrintColorMode | No| Color mode of the files to print.|
605| duplexMode | PrintDuplexMode | No| Duplex mode of the files to print.|
606
607## PrintPageRange<sup>11+</sup>
608
609Defines the print range.
610
611**System capability**: SystemCapability.Print.PrintFramework
612
613**Attributes**
614| **Name**| **Type**| **Mandatory**| **Description**|
615| -------- | -------- | -------- | -------- |
616| startPage | number | No| Start page.|
617| endPage | number | No| End page.|
618| pages | Array&lt;number&gt; | No| Discrete pages.|
619
620
621## PrintPageSize<sup>11+</sup>
622
623Defines the size of the printed page.
624
625**System capability**: SystemCapability.Print.PrintFramework
626
627**Attributes**
628| **Name**| **Type**| **Mandatory**| **Description**|
629| -------- | -------- | -------- | -------- |
630| id | string | Yes| Page size ID.|
631| name | string | Yes| Page size name.|
632| width | number | Yes| Page width, in millimeters.|
633| height | number | Yes| Page height, in millimeters.|
634
635
636
637## PrintDirectionMode<sup>11+</sup>
638
639Enumerates the print direction modes.
640
641**System capability**: SystemCapability.Print.PrintFramework
642
643| **Name**| **Value**| **Description**|
644| -------- | -------- | -------- |
645| DIRECTION_MODE_AUTO | 0 | Automatic.|
646| DIRECTION_MODE_PORTRAIT | 1 | Portrait mode.|
647| DIRECTION_MODE_LANDSCAPE | 2 | Landscape mode.|
648
649## PrintColorMode<sup>11+</sup>
650
651Enumerates the color modes.
652
653**System capability**: SystemCapability.Print.PrintFramework
654
655| **Name**| **Value**| **Description**|
656| -------- | -------- | -------- |
657| COLOR_MODE_MONOCHROME | 0 | Black and white.|
658| COLOR_MODE_COLOR | 1 | Color.|
659
660## PrintDuplexMode<sup>11+</sup>
661
662Enumerates the duplex modes.
663
664**System capability**: SystemCapability.Print.PrintFramework
665
666| **Name**| **Value**| **Description**|
667| -------- | -------- | -------- |
668| DUPLEX_MODE_NONE | 0 | Simplex (single-sided).|
669| DUPLEX_MODE_LONG_EDGE | 1 | Duplex (double-sided) with flipping on long edge.|
670| DUPLEX_MODE_SHORT_EDGE | 2 | Duplex (double-sided) with flipping on short edge.|
671
672## PrintPageType<sup>11+</sup>
673
674Enumerates the print page types.
675
676**System capability**: SystemCapability.Print.PrintFramework
677
678| **Name**| **Value**| **Description**|
679| -------- | -------- | -------- |
680| PAGE_ISO_A3 | 0 | A3.|
681| PAGE_ISO_A4 | 1 | A4.|
682| PAGE_ISO_A5 | 2 | A5.|
683| PAGE_JIS_B5 | 3 | B5.|
684| PAGE_ISO_C5 | 4 | C5.|
685| PAGE_ISO_DL | 5 | DL.|
686| PAGE_LETTER | 6 | Letter.|
687| PAGE_LEGAL | 7 | Legal.|
688| PAGE_PHOTO_4X6 | 8 | 4 x 6 photo paper.|
689| PAGE_PHOTO_5X7 | 9 | 5 x 7 photo paper.|
690| PAGE_INT_DL_ENVELOPE | 10 | International envelope DL.|
691| PAGE_B_TABLOID | 11 | B Tabloid.|
692
693## PrintDocumentAdapterState<sup>11+</sup>
694
695Enumerates the print job states.
696
697**System capability**: SystemCapability.Print.PrintFramework
698
699| **Name**| **Value**| **Description**|
700| -------- | -------- | -------- |
701| PREVIEW_DESTROY | 0 | The preview fails.|
702| PRINT_TASK_SUCCEED | 1 | The print job is successful.|
703| PRINT_TASK_FAIL | 2 | The print job failed.|
704| PRINT_TASK_CANCEL | 3 | The print job is canceled.|
705| PRINT_TASK_BLOCK | 4 | The print job is blocked.|
706
707## PrintFileCreationState<sup>11+</sup>
708
709Enumerates the print file creation status.
710
711**System capability**: SystemCapability.Print.PrintFramework
712
713| **Name**| **Value**| **Description**|
714| -------- | -------- | -------- |
715| PRINT_FILE_CREATED | 0 | The print file is created successfully.|
716| PRINT_FILE_CREATION_FAILED | 1 | The print file fails to be created.|
717| PRINT_FILE_CREATED_UNRENDERED | 2 | The print file is successfully created but not rendered.|
718