1/* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit BasicServicesKit 19 */ 20 21import type { AsyncCallback, Callback } from './@ohos.base'; 22import type Context from './application/Context'; 23 24/** 25 * System print 26 * 27 * @namespace print 28 * @syscap SystemCapability.Print.PrintFramework 29 * @since 10 30 */ 31declare namespace print { 32 33 /** 34 * PrintTask provide event callback. 35 * @interface PrintTask 36 * @syscap SystemCapability.Print.PrintFramework 37 * @since 10 38 */ 39 interface PrintTask { 40 /** 41 * Register event callback when the current print task is in process. 42 * @permission ohos.permission.PRINT 43 * @param { 'block' } type - Indicates the print task has been blocked. 44 * @param { Callback<void> } callback - The callback function for print task change event 45 * @throws { BusinessError } 201 - the application does not have permission to call this function. 46 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 47 * @syscap SystemCapability.Print.PrintFramework 48 * @since 10 49 */ 50 on(type: 'block', callback: Callback<void>): void; 51 52 /** 53 * Register event callback when the current print task is in process. 54 * @permission ohos.permission.PRINT 55 * @param { 'succeed' } type - Indicates the print task succeed. 56 * @param { Callback<void> } callback - The callback function for print task change event 57 * @throws { BusinessError } 201 - the application does not have permission to call this function. 58 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 59 * @syscap SystemCapability.Print.PrintFramework 60 * @since 10 61 */ 62 on(type: 'succeed', callback: Callback<void>): void; 63 64 /** 65 * Register event callback when the current print task is in process. 66 * @permission ohos.permission.PRINT 67 * @param { 'fail' } type - Indicates the print task has completed with failure. 68 * @param { Callback<void> } callback - The callback function for print task change event 69 * @throws { BusinessError } 201 - the application does not have permission to call this function. 70 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 71 * @syscap SystemCapability.Print.PrintFramework 72 * @since 10 73 */ 74 on(type: 'fail', callback: Callback<void>): void; 75 76 /** 77 * Register event callback when the current print task is in process. 78 * @permission ohos.permission.PRINT 79 * @param { 'cancel' } type - Indicates the print task has been cancelled. 80 * @param { Callback<void> } callback - The callback function for print task change event 81 * @throws { BusinessError } 201 - the application does not have permission to call this function. 82 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 83 * @syscap SystemCapability.Print.PrintFramework 84 * @since 10 85 */ 86 on(type: 'cancel', callback: Callback<void>): void; 87 88 /** 89 * Unregister event callback when the current print task is in process. 90 * @permission ohos.permission.PRINT 91 * @param { 'block' } type - Indicates the print task has been blocked. 92 * @param { Callback<void> } callback - The callback function for print task change event 93 * @throws { BusinessError } 201 - the application does not have permission to call this function. 94 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 95 * @syscap SystemCapability.Print.PrintFramework 96 * @since 10 97 */ 98 off(type: 'block', callback?: Callback<void>): void; 99 100 /** 101 * Unregister event callback when the current print task is in process. 102 * @permission ohos.permission.PRINT 103 * @param { 'succeed' } type - Indicates the print task succeed. 104 * @param { Callback<void> } callback - The callback function for print task change event 105 * @throws { BusinessError } 201 - the application does not have permission to call this function. 106 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 107 * @syscap SystemCapability.Print.PrintFramework 108 * @since 10 109 */ 110 off(type: 'succeed', callback?: Callback<void>): void; 111 112 /** 113 * Unregister event callback when the current print task is in process. 114 * @permission ohos.permission.PRINT 115 * @param { 'fail' } type - Indicates the print task has completed with failure. 116 * @param { Callback<void> } callback - The callback function for print task change event 117 * @throws { BusinessError } 201 - the application does not have permission to call this function. 118 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 119 * @syscap SystemCapability.Print.PrintFramework 120 * @since 10 121 */ 122 off(type: 'fail', callback?: Callback<void>): void; 123 124 /** 125 * Unregister event callback when the current print task is in process. 126 * @permission ohos.permission.PRINT 127 * @param { 'cancel' } type - Indicates the print task has been cancelled. 128 * @param { Callback<void> } callback - The callback function for print task change event 129 * @throws { BusinessError } 201 - the application does not have permission to call this function. 130 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 131 * @syscap SystemCapability.Print.PrintFramework 132 * @since 10 133 */ 134 off(type: 'cancel', callback?: Callback<void>): void; 135 } 136 137 /** 138 * Third-party application implement this interface to render files to be printed. 139 * @interface PrintDocumentAdapter 140 * @syscap SystemCapability.Print.PrintFramework 141 * @since 11 142 */ 143 interface PrintDocumentAdapter { 144 145 /** 146 * Implement this function to update the print file. 147 * @permission ohos.permission.PRINT 148 * @param { string } jobId - Indicates print job id. 149 * @param { PrintAttributes } oldAttrs - Indicates old print attributes. 150 * @param { PrintAttributes } newAttrs - Indicates new print attributes. 151 * @param { number } fd - Indicates print file fd. 152 * @param { function } writeResultCallback - Indicates this function should execute after the file is updated. 153 * @throws { BusinessError } 201 - the application does not have permission to call this function. 154 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 155 * @syscap SystemCapability.Print.PrintFramework 156 * @since 11 157 */ 158 onStartLayoutWrite(jobId: string, oldAttrs: PrintAttributes, newAttrs: PrintAttributes, fd: number, 159 writeResultCallback: (jobId: string, writeResult: PrintFileCreationState) => void): void; 160 161 /** 162 * Implement this function to listen job status change. 163 * @permission ohos.permission.PRINT 164 * @param { string } jobId - Indicates print job id. 165 * @param { PrintDocumentAdapterState } state - Indicates job changes to this state. 166 * @throws { BusinessError } 201 - the application does not have permission to call this function. 167 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 168 * @syscap SystemCapability.Print.PrintFramework 169 * @since 11 170 */ 171 onJobStateChanged(jobId: string, state: PrintDocumentAdapterState): void; 172 } 173 174 /** 175 * Start new print task for App. 176 * @permission ohos.permission.PRINT 177 * @param { Array<string> } files - Indicates the filepath list to be printed. Only pdf and picture filetype are supported. 178 * @param { AsyncCallback<PrintTask> } callback - The callback function for print task. 179 * @throws { BusinessError } 201 - the application does not have permission to call this function. 180 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 181 * @syscap SystemCapability.Print.PrintFramework 182 * @since 10 183 */ 184 function print(files: Array<string>, callback: AsyncCallback<PrintTask>): void; 185 186 /** 187 * Start new print task for App. 188 * @permission ohos.permission.PRINT 189 * @param { Array<string> } files - Indicates the filepath list to be printed. Only pdf and picture filetype are supported. 190 * @returns { Promise<PrintTask> } the promise returned by the function. 191 * @throws { BusinessError } 201 - the application does not have permission to call this function. 192 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 193 * @syscap SystemCapability.Print.PrintFramework 194 * @since 10 195 */ 196 function print(files: Array<string>): Promise<PrintTask>; 197 198 /** 199 * Start new print task for App. 200 * @permission ohos.permission.PRINT 201 * @param { Array<string> } files - Indicates the filepath list to be printed. Only pdf and picture filetype are supported. 202 * @param { Context } context - The ability context that initiates the call print request. 203 * @param { AsyncCallback<PrintTask> } callback - The callback function for print task. 204 * @throws { BusinessError } 201 - the application does not have permission to call this function. 205 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 206 * @syscap SystemCapability.Print.PrintFramework 207 * @since 11 208 */ 209 function print(files: Array<string>, context: Context, callback: AsyncCallback<PrintTask>): void; 210 211 /** 212 * Start new print task for App. 213 * @permission ohos.permission.PRINT 214 * @param { Array<string> } files - Indicates the filepath list to be printed. Only pdf and picture filetype are supported. 215 * @param { Context } context - The ability context that initiates the call print request. 216 * @returns { Promise<PrintTask> } the promise returned by the function. 217 * @throws { BusinessError } 201 - the application does not have permission to call this function. 218 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 219 * @syscap SystemCapability.Print.PrintFramework 220 * @since 11 221 */ 222 function print(files: Array<string>, context: Context): Promise<PrintTask>; 223 224 /** 225 * Start new print task for App And the App need update print file. 226 * @permission ohos.permission.PRINT 227 * @param { string } jobName - Indicates print file Name. 228 * @param { PrintDocumentAdapter } printAdapter - Indicates functions implemented by the cpp. 229 * @param { PrintAttributes } printAttributes - Indicates print attributes. 230 * @param { Context } context - The ability context that initiates the call print request. 231 * @returns { Promise<PrintTask> } the promise returned by the function. 232 * @throws { BusinessError } 201 - the application does not have permission to call this function. 233 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 234 * @syscap SystemCapability.Print.PrintFramework 235 * @since 11 236 */ 237 function print(jobName: string, printAdapter: PrintDocumentAdapter, printAttributes: PrintAttributes, 238 context: Context): Promise<PrintTask>; 239 240 /** 241 * defines print attributes. 242 * @typedef PrintAttributes 243 * @syscap SystemCapability.Print.PrintFramework 244 * @since 11 245 */ 246 interface PrintAttributes { 247 /** 248 * Copies of document list. 249 * @type { ?number } 250 * @syscap SystemCapability.Print.PrintFramework 251 * @since 11 252 */ 253 copyNumber?: number; 254 255 /** 256 * Range size to be printed. 257 * @type { ?PrintPageRange } 258 * @syscap SystemCapability.Print.PrintFramework 259 * @since 11 260 */ 261 pageRange?: PrintPageRange; 262 263 /** 264 * Page size. 265 * @type { ?(PrintPageSize | PrintPageType) } 266 * @syscap SystemCapability.Print.PrintFramework 267 * @since 11 268 */ 269 pageSize?: PrintPageSize | PrintPageType; 270 271 /** 272 * Print direction. 273 * @type { ?PrintDirectionMode } 274 * @syscap SystemCapability.Print.PrintFramework 275 * @since 11 276 */ 277 directionMode?: PrintDirectionMode; 278 279 /** 280 * Color mode. 281 * @type { ?PrintColorMode } 282 * @syscap SystemCapability.Print.PrintFramework 283 * @since 11 284 */ 285 colorMode?: PrintColorMode; 286 287 /** 288 * Duplex mode. 289 * @type { ?PrintDuplexMode } 290 * @syscap SystemCapability.Print.PrintFramework 291 * @since 11 292 */ 293 duplexMode?: PrintDuplexMode; 294 } 295 296 /** 297 * defines print page range. 298 * @typedef PrintPageRange 299 * @syscap SystemCapability.Print.PrintFramework 300 * @since 11 301 */ 302 interface PrintPageRange { 303 /** 304 * Start page of sequence. 305 * @type { ?number } 306 * @syscap SystemCapability.Print.PrintFramework 307 * @since 11 308 */ 309 startPage?: number; 310 311 /** 312 * End page of sequence. 313 * @type { ?number } 314 * @syscap SystemCapability.Print.PrintFramework 315 * @since 11 316 */ 317 endPage?: number; 318 319 /** 320 * Discrete page of sequence. 321 * @type { ?Array<number> } 322 * @syscap SystemCapability.Print.PrintFramework 323 * @since 11 324 */ 325 pages?: Array<number>; 326 } 327 328 /** 329 * defines print margin. 330 * @typedef PrintMargin 331 * @syscap SystemCapability.Print.PrintFramework 332 * @systemapi Hide this for inner system use. 333 * @since 10 334 */ 335 interface PrintMargin { 336 /** 337 * Top margin. 338 * @type { ?number } 339 * @syscap SystemCapability.Print.PrintFramework 340 * @systemapi 341 * @since 10 342 */ 343 top?: number; 344 345 /** 346 * Bottom margin. 347 * @type { ?number } 348 * @syscap SystemCapability.Print.PrintFramework 349 * @systemapi 350 * @since 10 351 */ 352 bottom?: number; 353 354 /** 355 * Left margin. 356 * @type { ?number } 357 * @syscap SystemCapability.Print.PrintFramework 358 * @systemapi 359 * @since 10 360 */ 361 left?: number; 362 363 /** 364 * Right margin. 365 * @type { ?number } 366 * @syscap SystemCapability.Print.PrintFramework 367 * @systemapi 368 * @since 10 369 */ 370 right?: number; 371 } 372 373 /** 374 * defines print range. 375 * @typedef PrinterRange 376 * @syscap SystemCapability.Print.PrintFramework 377 * @systemapi Hide this for inner system use. 378 * @since 10 379 */ 380 interface PrinterRange { 381 /** 382 * Start page of sequence. 383 * @type { ?number } 384 * @syscap SystemCapability.Print.PrintFramework 385 * @systemapi 386 * @since 10 387 */ 388 startPage?: number; 389 390 /** 391 * End page of sequence. 392 * @type { ?number } 393 * @syscap SystemCapability.Print.PrintFramework 394 * @systemapi 395 * @since 10 396 */ 397 endPage?: number; 398 399 /** 400 * Discrete page of sequence. 401 * @type { ?Array<number> } 402 * @syscap SystemCapability.Print.PrintFramework 403 * @systemapi 404 * @since 10 405 */ 406 pages?: Array<number>; 407 } 408 409 /** 410 * defines print preview attribute. 411 * @typedef PreviewAttribute 412 * @syscap SystemCapability.Print.PrintFramework 413 * @systemapi Hide this for inner system use. 414 * @since 10 415 */ 416 interface PreviewAttribute { 417 /** 418 * Preview page range. 419 * @type { PrinterRange } 420 * @syscap SystemCapability.Print.PrintFramework 421 * @systemapi 422 * @since 10 423 */ 424 previewRange: PrinterRange; 425 426 /** 427 * Preview file result. 428 * @type { ?number } 429 * @syscap SystemCapability.Print.PrintFramework 430 * @systemapi 431 * @since 10 432 */ 433 result?: number; 434 } 435 436 /** 437 * defines print resolution. 438 * @typedef PrintResolution 439 * @syscap SystemCapability.Print.PrintFramework 440 * @systemapi Hide this for inner system use. 441 * @since 10 442 */ 443 interface PrintResolution { 444 /** 445 * Resolution id. 446 * @type { string } 447 * @syscap SystemCapability.Print.PrintFramework 448 * @systemapi 449 * @since 10 450 */ 451 id: string; 452 453 /** 454 * Horizontal DPI. 455 * @type { number } 456 * @syscap SystemCapability.Print.PrintFramework 457 * @systemapi 458 * @since 10 459 */ 460 horizontalDpi: number; 461 462 /** 463 * Vertical DPI. 464 * @type { number } 465 * @syscap SystemCapability.Print.PrintFramework 466 * @systemapi 467 * @since 10 468 */ 469 verticalDpi: number; 470 } 471 472 /** 473 * defines print page size. 474 * @typedef PrintPageSize 475 * @syscap SystemCapability.Print.PrintFramework 476 * @since 11 477 */ 478 interface PrintPageSize { 479 /** 480 * Page size id. 481 * @type { string } 482 * @syscap SystemCapability.Print.PrintFramework 483 * @since 11 484 */ 485 id: string; 486 487 /** 488 * Page size name. 489 * @type { string } 490 * @syscap SystemCapability.Print.PrintFramework 491 * @since 11 492 */ 493 name: string; 494 495 /** 496 * Unit: millimeter width. 497 * @type { number } 498 * @syscap SystemCapability.Print.PrintFramework 499 * @since 11 500 */ 501 width: number; 502 503 /** 504 * Unit: millimeter height. 505 * @type { number } 506 * @syscap SystemCapability.Print.PrintFramework 507 * @since 11 508 */ 509 height: number; 510 } 511 512 /** 513 * defines print capability. 514 * @typedef PrinterCapability 515 * @syscap SystemCapability.Print.PrintFramework 516 * @systemapi Hide this for inner system use. 517 * @since 10 518 */ 519 interface PrinterCapability { 520 /** 521 * Color mode. 522 * @type { number } 523 * @syscap SystemCapability.Print.PrintFramework 524 * @systemapi 525 * @since 10 526 */ 527 colorMode: number; 528 529 /** 530 * Duplex mode. 531 * @type { number } 532 * @syscap SystemCapability.Print.PrintFramework 533 * @systemapi 534 * @since 10 535 */ 536 duplexMode: number; 537 538 /** 539 * The page size list supported by the printer. 540 * @type { Array<PrintPageSize> } 541 * @syscap SystemCapability.Print.PrintFramework 542 * @systemapi 543 * @since 10 544 */ 545 pageSize: Array<PrintPageSize>; 546 547 /** 548 * The resolution list supported by the printer. 549 * @type { ?Array<PrintResolution> } 550 * @syscap SystemCapability.Print.PrintFramework 551 * @systemapi 552 * @since 10 553 */ 554 resolution?: Array<PrintResolution>; 555 556 /** 557 * Min margin of printer. 558 * @type { ?PrintMargin } 559 * @syscap SystemCapability.Print.PrintFramework 560 * @systemapi 561 * @since 10 562 */ 563 minMargin?: PrintMargin; 564 565 /** 566 * JSON object string. 567 * @type { ?Object } 568 * @syscap SystemCapability.Print.PrintFramework 569 * @systemapi 570 * @since 11 571 */ 572 options?: Object; 573 } 574 575 /** 576 * defines print info. 577 * @typedef PrinterInfo 578 * @syscap SystemCapability.Print.PrintFramework 579 * @systemapi Hide this for inner system use. 580 * @since 10 581 */ 582 interface PrinterInfo { 583 /** 584 * Printer id. 585 * @type { string } 586 * @syscap SystemCapability.Print.PrintFramework 587 * @systemapi 588 * @since 10 589 */ 590 printerId: string; 591 592 /** 593 * Printer name. 594 * @type { string } 595 * @syscap SystemCapability.Print.PrintFramework 596 * @systemapi 597 * @since 10 598 */ 599 printerName: string; 600 601 /** 602 * Current printer state. 603 * @type { PrinterState } 604 * @syscap SystemCapability.Print.PrintFramework 605 * @systemapi 606 * @since 10 607 */ 608 printerState: PrinterState; 609 610 /** 611 * Resource id of printer icon. 612 * @type { ?number } 613 * @syscap SystemCapability.Print.PrintFramework 614 * @systemapi 615 * @since 10 616 */ 617 printerIcon?: number; 618 619 /** 620 * Printer description. 621 * @type { ?string } 622 * @syscap SystemCapability.Print.PrintFramework 623 * @systemapi 624 * @since 10 625 */ 626 description?: string; 627 628 /** 629 * Printer capability. 630 * @type { ?PrinterCapability } 631 * @syscap SystemCapability.Print.PrintFramework 632 * @systemapi 633 * @since 10 634 */ 635 capability?: PrinterCapability; 636 637 /** 638 * JSON object string. 639 * @type { ?Object } 640 * @syscap SystemCapability.Print.PrintFramework 641 * @systemapi 642 * @since 10 643 */ 644 options?: Object; 645 } 646 647 /** 648 * defines print job. 649 * @typedef PrintJob 650 * @syscap SystemCapability.Print.PrintFramework 651 * @systemapi Hide this for inner system use. 652 * @since 10 653 */ 654 interface PrintJob { 655 /** 656 * Document fd list to be printed. 657 * @type { Array<number> } 658 * @syscap SystemCapability.Print.PrintFramework 659 * @systemapi 660 * @since 10 661 */ 662 fdList: Array<number>; 663 664 /** 665 * Job id. 666 * @type { string } 667 * @syscap SystemCapability.Print.PrintFramework 668 * @systemapi 669 * @since 10 670 */ 671 jobId: string; 672 673 /** 674 * Printer id to take charge of printing. 675 * @type { string } 676 * @syscap SystemCapability.Print.PrintFramework 677 * @systemapi 678 * @since 10 679 */ 680 printerId: string; 681 682 /** 683 * Current print job state. 684 * @type { PrintJobState } 685 * @syscap SystemCapability.Print.PrintFramework 686 * @systemapi 687 * @since 10 688 */ 689 jobState: PrintJobState; 690 691 /** 692 * Current print job sub state. 693 * @type { PrintJobSubState } 694 * @syscap SystemCapability.Print.PrintFramework 695 * @systemapi 696 * @since 11 697 */ 698 jobSubstate: PrintJobSubState; 699 700 /** 701 * Copies of document list. 702 * @type { number } 703 * @syscap SystemCapability.Print.PrintFramework 704 * @systemapi 705 * @since 10 706 */ 707 copyNumber: number; 708 709 /** 710 * Range size to be printed. 711 * @type { PrinterRange } 712 * @syscap SystemCapability.Print.PrintFramework 713 * @systemapi 714 * @since 10 715 */ 716 pageRange: PrinterRange; 717 718 /** 719 * Sequential print. 720 * @type { boolean } 721 * @syscap SystemCapability.Print.PrintFramework 722 * @systemapi 723 * @since 10 724 */ 725 isSequential: boolean; 726 727 /** 728 * The selected page size. 729 * @type { PrintPageSize } 730 * @syscap SystemCapability.Print.PrintFramework 731 * @systemapi 732 * @since 10 733 */ 734 pageSize: PrintPageSize; 735 736 /** 737 * Vertical printing. 738 * @type { boolean } 739 * @syscap SystemCapability.Print.PrintFramework 740 * @systemapi 741 * @since 10 742 */ 743 isLandscape: boolean; 744 745 /** 746 * Color mode. 747 * @type { number } 748 * @syscap SystemCapability.Print.PrintFramework 749 * @systemapi 750 * @since 10 751 */ 752 colorMode: number; 753 754 /** 755 * Duplex mode. 756 * @type { number } 757 * @syscap SystemCapability.Print.PrintFramework 758 * @systemapi 759 * @since 10 760 */ 761 duplexMode: number; 762 763 /** 764 * Current margin setting. 765 * @type { ?PrintMargin } 766 * @syscap SystemCapability.Print.PrintFramework 767 * @systemapi 768 * @since 10 769 */ 770 margin?: PrintMargin; 771 772 /** 773 * Preview setting. 774 * @type { ?PreviewAttribute } 775 * @syscap SystemCapability.Print.PrintFramework 776 * @systemapi 777 * @since 10 778 */ 779 preview?: PreviewAttribute; 780 781 /** 782 * JSON object string. 783 * @type { ?Object } 784 * @syscap SystemCapability.Print.PrintFramework 785 * @systemapi 786 * @since 10 787 */ 788 options?: Object; 789 } 790 791 /** 792 * Enumeration of Print Direction Mode. 793 * @enum { number } PrintDirectionMode 794 * @syscap SystemCapability.Print.PrintFramework 795 * @since 11 796 */ 797 enum PrintDirectionMode { 798 /** 799 * Automatically select direction. 800 * @syscap SystemCapability.Print.PrintFramework 801 * @since 11 802 */ 803 DIRECTION_MODE_AUTO = 0, 804 805 /** 806 * Print portrait. 807 * @syscap SystemCapability.Print.PrintFramework 808 * @since 11 809 */ 810 DIRECTION_MODE_PORTRAIT = 1, 811 812 /** 813 * Print landscape. 814 * @syscap SystemCapability.Print.PrintFramework 815 * @since 11 816 */ 817 DIRECTION_MODE_LANDSCAPE = 2, 818 } 819 820 /** 821 * Enumeration of Print Color Mode. 822 * @enum { number } PrintColorMode 823 * @syscap SystemCapability.Print.PrintFramework 824 * @since 11 825 */ 826 enum PrintColorMode { 827 /** 828 * Print monochrome. 829 * @syscap SystemCapability.Print.PrintFramework 830 * @since 11 831 */ 832 COLOR_MODE_MONOCHROME = 0, 833 834 /** 835 * Color printing. 836 * @syscap SystemCapability.Print.PrintFramework 837 * @since 11 838 */ 839 COLOR_MODE_COLOR = 1, 840 } 841 842 /** 843 * Enumeration of Print Duplex Mode. 844 * @enum { number } PrintDuplexMode 845 * @syscap SystemCapability.Print.PrintFramework 846 * @since 11 847 */ 848 enum PrintDuplexMode { 849 /** 850 * Single side printing. 851 * @syscap SystemCapability.Print.PrintFramework 852 * @since 11 853 */ 854 DUPLEX_MODE_NONE = 0, 855 856 /** 857 * Long-edge flip-up duplex printing. 858 * @syscap SystemCapability.Print.PrintFramework 859 * @since 11 860 */ 861 DUPLEX_MODE_LONG_EDGE = 1, 862 863 /** 864 * Short-edge flip-up duplex printing. 865 * @syscap SystemCapability.Print.PrintFramework 866 * @since 11 867 */ 868 DUPLEX_MODE_SHORT_EDGE = 2, 869 } 870 871 /** 872 * Enumeration of Print Page Type. 873 * @enum { number } PrintPageType 874 * @syscap SystemCapability.Print.PrintFramework 875 * @since 11 876 */ 877 enum PrintPageType { 878 /** 879 * A3 page. 880 * @syscap SystemCapability.Print.PrintFramework 881 * @since 11 882 */ 883 PAGE_ISO_A3 = 0, 884 885 /** 886 * A4 page. 887 * @syscap SystemCapability.Print.PrintFramework 888 * @since 11 889 */ 890 PAGE_ISO_A4 = 1, 891 892 /** 893 * A5 page. 894 * @syscap SystemCapability.Print.PrintFramework 895 * @since 11 896 */ 897 PAGE_ISO_A5 = 2, 898 899 /** 900 * B5 page. 901 * @syscap SystemCapability.Print.PrintFramework 902 * @since 11 903 */ 904 PAGE_JIS_B5 = 3, 905 906 /** 907 * C5 page. 908 * @syscap SystemCapability.Print.PrintFramework 909 * @since 11 910 */ 911 PAGE_ISO_C5 = 4, 912 913 /** 914 * DL Envelope. 915 * @syscap SystemCapability.Print.PrintFramework 916 * @since 11 917 */ 918 PAGE_ISO_DL = 5, 919 920 /** 921 * Letter. 922 * @syscap SystemCapability.Print.PrintFramework 923 * @since 11 924 */ 925 PAGE_LETTER = 6, 926 927 /** 928 * Legal. 929 * @syscap SystemCapability.Print.PrintFramework 930 * @since 11 931 */ 932 PAGE_LEGAL = 7, 933 934 /** 935 * Photo 4x6. 936 * @syscap SystemCapability.Print.PrintFramework 937 * @since 11 938 */ 939 PAGE_PHOTO_4X6 = 8, 940 941 /** 942 * Photo 5x7. 943 * @syscap SystemCapability.Print.PrintFramework 944 * @since 11 945 */ 946 PAGE_PHOTO_5X7 = 9, 947 948 /** 949 * Envelope INT DL. 950 * @syscap SystemCapability.Print.PrintFramework 951 * @since 11 952 */ 953 PAGE_INT_DL_ENVELOPE = 10, 954 955 /** 956 * Tabloid B. 957 * @syscap SystemCapability.Print.PrintFramework 958 * @since 11 959 */ 960 PAGE_B_TABLOID = 11, 961 } 962 963 /** 964 * Enumeration of Print Document Adapter State. 965 * @enum { number } PrintDocumentAdapterState 966 * @syscap SystemCapability.Print.PrintFramework 967 * @since 11 968 */ 969 enum PrintDocumentAdapterState { 970 /** 971 * Preview failed. 972 * @syscap SystemCapability.Print.PrintFramework 973 * @since 11 974 */ 975 PREVIEW_DESTROY = 0, 976 977 /** 978 * Print state is succeed. 979 * @syscap SystemCapability.Print.PrintFramework 980 * @since 11 981 */ 982 PRINT_TASK_SUCCEED = 1, 983 984 /** 985 * Print state is fail. 986 * @syscap SystemCapability.Print.PrintFramework 987 * @since 11 988 */ 989 PRINT_TASK_FAIL = 2, 990 991 /** 992 * Print state is cancel. 993 * @syscap SystemCapability.Print.PrintFramework 994 * @since 11 995 */ 996 PRINT_TASK_CANCEL = 3, 997 998 /** 999 * Print state is block. 1000 * @syscap SystemCapability.Print.PrintFramework 1001 * @since 11 1002 */ 1003 PRINT_TASK_BLOCK = 4, 1004 } 1005 1006 /** 1007 * Enumeration of Print File Creation State. 1008 * @enum { number } PrintFileCreationState 1009 * @syscap SystemCapability.Print.PrintFramework 1010 * @since 11 1011 */ 1012 enum PrintFileCreationState { 1013 /** 1014 * Print file created success. 1015 * @syscap SystemCapability.Print.PrintFramework 1016 * @since 11 1017 */ 1018 PRINT_FILE_CREATED = 0, 1019 1020 /** 1021 * Print file created fail. 1022 * @syscap SystemCapability.Print.PrintFramework 1023 * @since 11 1024 */ 1025 PRINT_FILE_CREATION_FAILED = 1, 1026 1027 /** 1028 * Print file created success but unrendered. 1029 * @syscap SystemCapability.Print.PrintFramework 1030 * @since 11 1031 */ 1032 PRINT_FILE_CREATED_UNRENDERED = 2, 1033 } 1034 1035 /** 1036 * Enumeration of Printer State. 1037 * @enum { number } PrinterState 1038 * @syscap SystemCapability.Print.PrintFramework 1039 * @systemapi Hide this for inner system use. 1040 * @since 10 1041 */ 1042 enum PrinterState { 1043 /** 1044 * New printers arrival. 1045 * @syscap SystemCapability.Print.PrintFramework 1046 * @systemapi 1047 * @since 10 1048 */ 1049 PRINTER_ADDED = 0, 1050 1051 /** 1052 * Printer lost. 1053 * @syscap SystemCapability.Print.PrintFramework 1054 * @systemapi 1055 * @since 10 1056 */ 1057 PRINTER_REMOVED = 1, 1058 1059 /** 1060 * Printer update. 1061 * @syscap SystemCapability.Print.PrintFramework 1062 * @systemapi 1063 * @since 10 1064 */ 1065 PRINTER_CAPABILITY_UPDATED = 2, 1066 1067 /** 1068 * Printer has been connected. 1069 * @syscap SystemCapability.Print.PrintFramework 1070 * @systemapi 1071 * @since 10 1072 */ 1073 PRINTER_CONNECTED = 3, 1074 1075 /** 1076 * Printer has been disconnected. 1077 * @syscap SystemCapability.Print.PrintFramework 1078 * @systemapi 1079 * @since 10 1080 */ 1081 PRINTER_DISCONNECTED = 4, 1082 1083 /** 1084 * Printer is working. 1085 * @syscap SystemCapability.Print.PrintFramework 1086 * @systemapi 1087 * @since 10 1088 */ 1089 PRINTER_RUNNING = 5, 1090 } 1091 1092 /** 1093 * Enumeration of Print Job State. 1094 * @enum { number } PrintJobState 1095 * @syscap SystemCapability.Print.PrintFramework 1096 * @systemapi Hide this for inner system use. 1097 * @since 10 1098 */ 1099 enum PrintJobState { 1100 /** 1101 * Initial state of print job. 1102 * @syscap SystemCapability.Print.PrintFramework 1103 * @systemapi 1104 * @since 10 1105 */ 1106 PRINT_JOB_PREPARE = 0, 1107 1108 /** 1109 * Deliver print job to the printer. 1110 * @syscap SystemCapability.Print.PrintFramework 1111 * @systemapi 1112 * @since 10 1113 */ 1114 PRINT_JOB_QUEUED = 1, 1115 1116 /** 1117 * Executing print job. 1118 * @syscap SystemCapability.Print.PrintFramework 1119 * @systemapi 1120 * @since 10 1121 */ 1122 PRINT_JOB_RUNNING = 2, 1123 1124 /** 1125 * Print job has been blocked. 1126 * @syscap SystemCapability.Print.PrintFramework 1127 * @systemapi 1128 * @since 10 1129 */ 1130 PRINT_JOB_BLOCKED = 3, 1131 1132 /** 1133 * Print job completed. 1134 * @syscap SystemCapability.Print.PrintFramework 1135 * @systemapi 1136 * @since 10 1137 */ 1138 PRINT_JOB_COMPLETED = 4, 1139 } 1140 1141 /** 1142 * Enumeration of Print Job Sub State. 1143 * @enum { number } PrintJobSubState 1144 * @syscap SystemCapability.Print.PrintFramework 1145 * @systemapi Hide this for inner system use. 1146 * @since 10 1147 */ 1148 enum PrintJobSubState { 1149 /** 1150 * Print job succeed. 1151 * @syscap SystemCapability.Print.PrintFramework 1152 * @systemapi 1153 * @since 10 1154 */ 1155 PRINT_JOB_COMPLETED_SUCCESS = 0, 1156 1157 /** 1158 * Print job fail. 1159 * @syscap SystemCapability.Print.PrintFramework 1160 * @systemapi 1161 * @since 10 1162 */ 1163 PRINT_JOB_COMPLETED_FAILED = 1, 1164 1165 /** 1166 * Print job has been cancelled. 1167 * @syscap SystemCapability.Print.PrintFramework 1168 * @systemapi 1169 * @since 10 1170 */ 1171 PRINT_JOB_COMPLETED_CANCELLED = 2, 1172 1173 /** 1174 * Print job has been corrupted. 1175 * @syscap SystemCapability.Print.PrintFramework 1176 * @systemapi 1177 * @since 10 1178 */ 1179 PRINT_JOB_COMPLETED_FILE_CORRUPTED = 3, 1180 1181 /** 1182 * Print is offline. 1183 * @syscap SystemCapability.Print.PrintFramework 1184 * @systemapi 1185 * @since 10 1186 */ 1187 PRINT_JOB_BLOCK_OFFLINE = 4, 1188 1189 /** 1190 * Print is occupied by other process. 1191 * @syscap SystemCapability.Print.PrintFramework 1192 * @systemapi 1193 * @since 10 1194 */ 1195 PRINT_JOB_BLOCK_BUSY = 5, 1196 1197 /** 1198 * Print job has been cancelled. 1199 * @syscap SystemCapability.Print.PrintFramework 1200 * @systemapi 1201 * @since 10 1202 */ 1203 PRINT_JOB_BLOCK_CANCELLED = 6, 1204 1205 /** 1206 * Print out of paper. 1207 * @syscap SystemCapability.Print.PrintFramework 1208 * @systemapi 1209 * @since 10 1210 */ 1211 PRINT_JOB_BLOCK_OUT_OF_PAPER = 7, 1212 1213 /** 1214 * Print out of ink. 1215 * @syscap SystemCapability.Print.PrintFramework 1216 * @systemapi 1217 * @since 10 1218 */ 1219 PRINT_JOB_BLOCK_OUT_OF_INK = 8, 1220 1221 /** 1222 * Print out of toner. 1223 * @syscap SystemCapability.Print.PrintFramework 1224 * @systemapi 1225 * @since 10 1226 */ 1227 PRINT_JOB_BLOCK_OUT_OF_TONER = 9, 1228 1229 /** 1230 * Print paper jam. 1231 * @syscap SystemCapability.Print.PrintFramework 1232 * @systemapi 1233 * @since 10 1234 */ 1235 PRINT_JOB_BLOCK_JAMMED = 10, 1236 1237 /** 1238 * Print cover open. 1239 * @syscap SystemCapability.Print.PrintFramework 1240 * @systemapi 1241 * @since 10 1242 */ 1243 PRINT_JOB_BLOCK_DOOR_OPEN = 11, 1244 1245 /** 1246 * Print service request. 1247 * @syscap SystemCapability.Print.PrintFramework 1248 * @systemapi 1249 * @since 10 1250 */ 1251 PRINT_JOB_BLOCK_SERVICE_REQUEST = 12, 1252 1253 /** 1254 * Print low on ink. 1255 * @syscap SystemCapability.Print.PrintFramework 1256 * @systemapi 1257 * @since 10 1258 */ 1259 PRINT_JOB_BLOCK_LOW_ON_INK = 13, 1260 1261 /** 1262 * Print low on toner. 1263 * @syscap SystemCapability.Print.PrintFramework 1264 * @systemapi 1265 * @since 10 1266 */ 1267 PRINT_JOB_BLOCK_LOW_ON_TONER = 14, 1268 1269 /** 1270 * Print really low on ink. 1271 * @syscap SystemCapability.Print.PrintFramework 1272 * @systemapi 1273 * @since 10 1274 */ 1275 PRINT_JOB_BLOCK_REALLY_LOW_ON_INK = 15, 1276 1277 /** 1278 * Print bad certification. 1279 * @syscap SystemCapability.Print.PrintFramework 1280 * @systemapi 1281 * @since 10 1282 */ 1283 PRINT_JOB_BLOCK_BAD_CERTIFICATE = 16, 1284 1285 /** 1286 * Print an error occurred when printing the account. 1287 * @syscap SystemCapability.Print.PrintFramework 1288 * @systemapi 1289 * @since 11 1290 */ 1291 PRINT_JOB_BLOCK_ACCOUNT_ERROR = 18, 1292 1293 /** 1294 * Print the printing permission is abnormal. 1295 * @syscap SystemCapability.Print.PrintFramework 1296 * @systemapi 1297 * @since 11 1298 */ 1299 PRINT_JOB_BLOCK_PRINT_PERMISSION_ERROR = 19, 1300 1301 /** 1302 * Print color printing permission exception. 1303 * @syscap SystemCapability.Print.PrintFramework 1304 * @systemapi 1305 * @since 11 1306 */ 1307 PRINT_JOB_BLOCK_PRINT_COLOR_PERMISSION_ERROR = 20, 1308 1309 /** 1310 * Print the device is not connected to the network. 1311 * @syscap SystemCapability.Print.PrintFramework 1312 * @systemapi 1313 * @since 11 1314 */ 1315 PRINT_JOB_BLOCK_NETWORK_ERROR = 21, 1316 1317 /** 1318 * Print unable to connect to the server. 1319 * @syscap SystemCapability.Print.PrintFramework 1320 * @systemapi 1321 * @since 11 1322 */ 1323 PRINT_JOB_BLOCK_SERVER_CONNECTION_ERROR = 22, 1324 1325 /** 1326 * Print large file exception. 1327 * @syscap SystemCapability.Print.PrintFramework 1328 * @systemapi 1329 * @since 11 1330 */ 1331 PRINT_JOB_BLOCK_LARGE_FILE_ERROR = 23, 1332 1333 /** 1334 * Print file parsing exception. 1335 * @syscap SystemCapability.Print.PrintFramework 1336 * @systemapi 1337 * @since 11 1338 */ 1339 PRINT_JOB_BLOCK_FILE_PARSING_ERROR = 24, 1340 1341 /** 1342 * Print the file conversion is too slow. 1343 * @syscap SystemCapability.Print.PrintFramework 1344 * @systemapi 1345 * @since 11 1346 */ 1347 PRINT_JOB_BLOCK_SLOW_FILE_CONVERSION = 25, 1348 1349 /** 1350 * Print uploading file. 1351 * @syscap SystemCapability.Print.PrintFramework 1352 * @systemapi 1353 * @since 11 1354 */ 1355 PRINT_JOB_RUNNING_UPLOADING_FILES = 26, 1356 1357 /** 1358 * Print converting files. 1359 * @syscap SystemCapability.Print.PrintFramework 1360 * @systemapi 1361 * @since 11 1362 */ 1363 PRINT_JOB_RUNNING_CONVERTING_FILES = 27, 1364 1365 /** 1366 * Print unknown issue. 1367 * @syscap SystemCapability.Print.PrintFramework 1368 * @systemapi 1369 * @since 10 1370 */ 1371 PRINT_JOB_BLOCK_UNKNOWN = 99, 1372 } 1373 1374 /** 1375 * Enumeration of Print error Code. 1376 * @enum { number } PrintErrorCode 1377 * @syscap SystemCapability.Print.PrintFramework 1378 * @systemapi Hide this for inner system use. 1379 * @since 10 1380 */ 1381 enum PrintErrorCode { 1382 /** 1383 * No error. 1384 * @syscap SystemCapability.Print.PrintFramework 1385 * @systemapi 1386 * @since 10 1387 */ 1388 E_PRINT_NONE = 0, 1389 1390 /** 1391 * No permission. 1392 * @syscap SystemCapability.Print.PrintFramework 1393 * @systemapi 1394 * @since 10 1395 */ 1396 E_PRINT_NO_PERMISSION = 201, 1397 1398 /** 1399 * Invalid parameter. 1400 * @syscap SystemCapability.Print.PrintFramework 1401 * @systemapi 1402 * @since 10 1403 */ 1404 E_PRINT_INVALID_PARAMETER = 401, 1405 1406 /** 1407 * Generic failure of print. 1408 * @syscap SystemCapability.Print.PrintFramework 1409 * @systemapi 1410 * @since 10 1411 */ 1412 E_PRINT_GENERIC_FAILURE = 13100001, 1413 1414 /** 1415 * RPC failure. 1416 * @syscap SystemCapability.Print.PrintFramework 1417 * @systemapi 1418 * @since 10 1419 */ 1420 E_PRINT_RPC_FAILURE = 13100002, 1421 1422 /** 1423 * Failure of print service. 1424 * @syscap SystemCapability.Print.PrintFramework 1425 * @systemapi 1426 * @since 10 1427 */ 1428 E_PRINT_SERVER_FAILURE = 13100003, 1429 1430 /** 1431 * Invalid print extension. 1432 * @syscap SystemCapability.Print.PrintFramework 1433 * @systemapi 1434 * @since 10 1435 */ 1436 E_PRINT_INVALID_EXTENSION = 13100004, 1437 1438 /** 1439 * Invalid printer. 1440 * @syscap SystemCapability.Print.PrintFramework 1441 * @systemapi 1442 * @since 10 1443 */ 1444 E_PRINT_INVALID_PRINTER = 13100005, 1445 1446 /** 1447 * Invalid print job. 1448 * @syscap SystemCapability.Print.PrintFramework 1449 * @systemapi 1450 * @since 10 1451 */ 1452 E_PRINT_INVALID_PRINT_JOB = 13100006, 1453 1454 /** 1455 * File i/o error. 1456 * @syscap SystemCapability.Print.PrintFramework 1457 * @systemapi 1458 * @since 10 1459 */ 1460 E_PRINT_FILE_IO = 13100007, 1461 } 1462 1463 /** 1464 * Enumeration of application event. 1465 * @enum { number } ApplicationEvent 1466 * @syscap SystemCapability.Print.PrintFramework 1467 * @systemapi Hide this for inner system use. 1468 * @since 12 1469 */ 1470 enum ApplicationEvent { 1471 /** 1472 * Application created. 1473 * @syscap SystemCapability.Print.PrintFramework 1474 * @systemapi 1475 * @since 12 1476 */ 1477 APPLICATION_CREATED = 0, 1478 1479 /** 1480 * Application closed for printing started. 1481 * @syscap SystemCapability.Print.PrintFramework 1482 * @systemapi 1483 * @since 12 1484 */ 1485 APPLICATION_CLOSED_FOR_STARTED = 1, 1486 1487 /** 1488 * Application closed for printing canceled. 1489 * @syscap SystemCapability.Print.PrintFramework 1490 * @systemapi 1491 * @since 12 1492 */ 1493 APPLICATION_CLOSED_FOR_CANCELED = 2, 1494 } 1495 1496 /** 1497 * defines print ExtensionInfo. 1498 * @typedef PrinterExtensionInfo 1499 * @syscap SystemCapability.Print.PrintFramework 1500 * @systemapi Hide this for inner system use. 1501 * @since 10 1502 */ 1503 interface PrinterExtensionInfo { 1504 /** 1505 * Extension id of printer extension. 1506 * @type { string } 1507 * @syscap SystemCapability.Print.PrintFramework 1508 * @systemapi 1509 * @since 10 1510 */ 1511 extensionId: string; 1512 1513 /** 1514 * Vendor id of extension. 1515 * @type { string } 1516 * @syscap SystemCapability.Print.PrintFramework 1517 * @systemapi 1518 * @since 10 1519 */ 1520 vendorId: string; 1521 1522 /** 1523 * Vendor name. 1524 * @type { string } 1525 * @syscap SystemCapability.Print.PrintFramework 1526 * @systemapi 1527 * @since 10 1528 */ 1529 vendorName: string; 1530 1531 /** 1532 * Vendor icon. 1533 * @type { number } 1534 * @syscap SystemCapability.Print.PrintFramework 1535 * @systemapi 1536 * @since 10 1537 */ 1538 vendorIcon: number; 1539 1540 /** 1541 * Version of current printer extension. 1542 * @type { string } 1543 * @syscap SystemCapability.Print.PrintFramework 1544 * @systemapi 1545 * @since 10 1546 */ 1547 version: string; 1548 } 1549 1550 /** 1551 * Get all printer extension installed. 1552 * @permission ohos.permission.MANAGE_PRINT_JOB 1553 * @param { AsyncCallback<Array<PrinterExtensionInfo>> } callback - The callback function for handling the extension list found. 1554 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1555 * @throws { BusinessError } 202 - not system application 1556 * @syscap SystemCapability.Print.PrintFramework 1557 * @systemapi Hide this for inner system use. 1558 * @since 10 1559 */ 1560 function queryAllPrinterExtensionInfos(callback: AsyncCallback<Array<PrinterExtensionInfo>>): void; 1561 1562 /** 1563 * Get all printer extension installed. 1564 * @permission ohos.permission.MANAGE_PRINT_JOB 1565 * @returns { Promise<Array<PrinterExtensionInfo>> } the promise returned by the function. 1566 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1567 * @throws { BusinessError } 202 - not system application 1568 * @syscap SystemCapability.Print.PrintFramework 1569 * @systemapi Hide this for inner system use. 1570 * @since 10 1571 */ 1572 function queryAllPrinterExtensionInfos(): Promise<Array<PrinterExtensionInfo>>; 1573 1574 /** 1575 * Load the specific printer extension and start to discover printer. 1576 * @permission ohos.permission.MANAGE_PRINT_JOB 1577 * @param { Array<string> } extensionList - Indicates the list of printer extension. 1578 * empty list of extensionList Indicates to find printer with all installed extension. 1579 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 1580 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1581 * @throws { BusinessError } 202 - not system application 1582 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1583 * @syscap SystemCapability.Print.PrintFramework 1584 * @systemapi Hide this for inner system use. 1585 * @since 10 1586 */ 1587 function startDiscoverPrinter(extensionList: Array<string>, callback: AsyncCallback<void>): void; 1588 1589 /** 1590 * Load the specific printer extension and start to discover printer. 1591 * @permission ohos.permission.MANAGE_PRINT_JOB 1592 * @param { Array<string> } extensionList - Indicates the list of printer extension. 1593 * empty list of extensionList Indicates to find printer with all installed extension. 1594 * @returns { Promise<void> } the promise returned by the function. 1595 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1596 * @throws { BusinessError } 202 - not system application 1597 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1598 * @syscap SystemCapability.Print.PrintFramework 1599 * @systemapi Hide this for inner system use. 1600 * @since 10 1601 */ 1602 function startDiscoverPrinter(extensionList: Array<string>): Promise<void>; 1603 1604 /** 1605 * Stop discovering the printer with specific printer extension. 1606 * @permission ohos.permission.MANAGE_PRINT_JOB 1607 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 1608 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1609 * @throws { BusinessError } 202 - not system application 1610 * @syscap SystemCapability.Print.PrintFramework 1611 * @systemapi Hide this for inner system use. 1612 * @since 10 1613 */ 1614 function stopDiscoverPrinter(callback: AsyncCallback<void>): void; 1615 1616 /** 1617 * Stop discovering the printer with specific printer extension. 1618 * @permission ohos.permission.MANAGE_PRINT_JOB 1619 * @returns { Promise<void> } the promise returned by the function. 1620 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1621 * @throws { BusinessError } 202 - not system application 1622 * @syscap SystemCapability.Print.PrintFramework 1623 * @systemapi Hide this for inner system use. 1624 * @since 10 1625 */ 1626 function stopDiscoverPrinter(): Promise<void>; 1627 1628 /** 1629 * Connect the specific printer. 1630 * @permission ohos.permission.MANAGE_PRINT_JOB 1631 * @param { string } printerId - Indicates id of the printer. 1632 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 1633 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1634 * @throws { BusinessError } 202 - not system application 1635 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1636 * @syscap SystemCapability.Print.PrintFramework 1637 * @systemapi Hide this for inner system use. 1638 * @since 10 1639 */ 1640 function connectPrinter(printerId: string, callback: AsyncCallback<void>): void; 1641 1642 /** 1643 * Connect the specific printer. 1644 * @permission ohos.permission.MANAGE_PRINT_JOB 1645 * @param { string } printerId - Indicates id of the printer. 1646 * @returns { Promise<void> } the promise returned by the function. 1647 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1648 * @throws { BusinessError } 202 - not system application 1649 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1650 * @syscap SystemCapability.Print.PrintFramework 1651 * @systemapi Hide this for inner system use. 1652 * @since 10 1653 */ 1654 function connectPrinter(printerId: string): Promise<void>; 1655 1656 /** 1657 * Disconnect the specific printer. 1658 * @permission ohos.permission.MANAGE_PRINT_JOB 1659 * @param { string } printerId - Indicates id of the printer. 1660 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 1661 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1662 * @throws { BusinessError } 202 - not system application 1663 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1664 * @syscap SystemCapability.Print.PrintFramework 1665 * @systemapi Hide this for inner system use. 1666 * @since 10 1667 */ 1668 function disconnectPrinter(printerId: string, callback: AsyncCallback<void>): void; 1669 1670 /** 1671 * Disconnect the specific printer. 1672 * @permission ohos.permission.MANAGE_PRINT_JOB 1673 * @param { string } printerId - Indicates id of the printer. 1674 * @returns { Promise<void> } the promise returned by the function. 1675 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1676 * @throws { BusinessError } 202 - not system application 1677 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1678 * @syscap SystemCapability.Print.PrintFramework 1679 * @systemapi Hide this for inner system use. 1680 * @since 10 1681 */ 1682 function disconnectPrinter(printerId: string): Promise<void>; 1683 1684 /** 1685 * Query capability for the specific printer. 1686 * @permission ohos.permission.MANAGE_PRINT_JOB 1687 * @param { string } printerId - Indicates id of the printer. 1688 * @param { AsyncCallback<void> } callback - The callback function for capability from printer. 1689 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1690 * @throws { BusinessError } 202 - not system application 1691 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1692 * @syscap SystemCapability.Print.PrintFramework 1693 * @systemapi Hide this for inner system use. 1694 * @since 10 1695 */ 1696 function queryPrinterCapability(printerId: string, callback: AsyncCallback<void>): void; 1697 1698 /** 1699 * Query capability for the specific printer. 1700 * @permission ohos.permission.MANAGE_PRINT_JOB 1701 * @param { string } printerId - Indicates id of the printer. 1702 * @returns { Promise<void> } the promise returned by the function. 1703 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1704 * @throws { BusinessError } 202 - not system application 1705 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1706 * @syscap SystemCapability.Print.PrintFramework 1707 * @systemapi Hide this for inner system use. 1708 * @since 10 1709 */ 1710 function queryPrinterCapability(printerId: string): Promise<void>; 1711 1712 /** 1713 * Start print job. 1714 * @permission ohos.permission.MANAGE_PRINT_JOB 1715 * @param { PrintJob } jobInfo - Indicates the information of print job. 1716 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 1717 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1718 * @throws { BusinessError } 202 - not system application 1719 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1720 * @syscap SystemCapability.Print.PrintFramework 1721 * @systemapi Hide this for inner system use. 1722 * @since 10 1723 */ 1724 function startPrintJob(jobInfo: PrintJob, callback: AsyncCallback<void>): void; 1725 1726 /** 1727 * Start print job. 1728 * @permission ohos.permission.MANAGE_PRINT_JOB 1729 * @param { PrintJob } jobInfo - Indicates the information of print job. 1730 * @returns { Promise<void> } the promise returned by the function. 1731 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1732 * @throws { BusinessError } 202 - not system application 1733 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1734 * @syscap SystemCapability.Print.PrintFramework 1735 * @systemapi Hide this for inner system use. 1736 * @since 10 1737 */ 1738 function startPrintJob(jobInfo: PrintJob): Promise<void>; 1739 1740 /** 1741 * Cancel the print job has been sent to printer. 1742 * @permission ohos.permission.MANAGE_PRINT_JOB 1743 * @param { string } jobId - Indicates the specific print job. 1744 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 1745 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1746 * @throws { BusinessError } 202 - not system application 1747 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1748 * @syscap SystemCapability.Print.PrintFramework 1749 * @systemapi Hide this for inner system use. 1750 * @since 10 1751 */ 1752 function cancelPrintJob(jobId: string, callback: AsyncCallback<void>): void; 1753 1754 /** 1755 * Cancel the print job has been sent to printer. 1756 * @permission ohos.permission.MANAGE_PRINT_JOB 1757 * @param { string } jobId - Indicates the specific print job. 1758 * @returns { Promise<void> } the promise returned by the function. 1759 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1760 * @throws { BusinessError } 202 - not system application 1761 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1762 * @syscap SystemCapability.Print.PrintFramework 1763 * @systemapi Hide this for inner system use. 1764 * @since 10 1765 */ 1766 function cancelPrintJob(jobId: string): Promise<void>; 1767 1768 /** 1769 * Request preview of the print job. 1770 * @permission ohos.permission.MANAGE_PRINT_JOB 1771 * @param { PrintJob } jobInfo - Indicates the information of print job. 1772 * @param { Callback<number> } callback - The callback function for indcating the result of API execution. 1773 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1774 * @throws { BusinessError } 202 - not system application 1775 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1776 * @syscap SystemCapability.Print.PrintFramework 1777 * @systemapi Hide this for inner system use. 1778 * @since 10 1779 */ 1780 function requestPrintPreview(jobInfo: PrintJob, callback: Callback<number>): void; 1781 1782 /** 1783 * Request preview of the print job. 1784 * @permission ohos.permission.MANAGE_PRINT_JOB 1785 * @param { PrintJob } jobInfo - Indicates the information of print job. 1786 * @returns { Promise<number> } the promise returned by the function. 1787 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1788 * @throws { BusinessError } 202 - not system application 1789 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1790 * @syscap SystemCapability.Print.PrintFramework 1791 * @systemapi Hide this for inner system use. 1792 * @since 10 1793 */ 1794 function requestPrintPreview(jobInfo: PrintJob): Promise<number>; 1795 1796 /** 1797 * Register event callback for the state change of printer. 1798 * @permission ohos.permission.MANAGE_PRINT_JOB 1799 * @param { 'printerStateChange' } type - Indicates state change of printer. 1800 * @param { function } callback - The callback function for state change of printer. 1801 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1802 * @throws { BusinessError } 202 - not system application 1803 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1804 * @syscap SystemCapability.Print.PrintFramework 1805 * @systemapi Hide this for inner system use. 1806 * @since 10 1807 */ 1808 function on(type: 'printerStateChange', callback: (state: PrinterState, info: PrinterInfo) => void): void; 1809 1810 /** 1811 * Unregister event callback for the state change of printer. 1812 * @permission ohos.permission.MANAGE_PRINT_JOB 1813 * @param { 'printerStateChange' } type - Indicates state change of printer. 1814 * @param { Callback<boolean> } callback - The callback function for state change of printer. 1815 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1816 * @throws { BusinessError } 202 - not system application 1817 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1818 * @syscap SystemCapability.Print.PrintFramework 1819 * @systemapi Hide this for inner system use. 1820 * @since 10 1821 */ 1822 function off(type: 'printerStateChange', callback?: Callback<boolean>): void; 1823 1824 /** 1825 * Register event callback for the state change of print job. 1826 * @permission ohos.permission.MANAGE_PRINT_JOB 1827 * @param { 'jobStateChange' } type - Indicates state change of printer. 1828 * @param { function } callback - The callback function for state change of printer. 1829 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1830 * @throws { BusinessError } 202 - not system application 1831 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1832 * @syscap SystemCapability.Print.PrintFramework 1833 * @systemapi Hide this for inner system use. 1834 * @since 10 1835 */ 1836 function on(type: 'jobStateChange', callback: (state: PrintJobState, job: PrintJob) => void): void; 1837 1838 /** 1839 * Unregister event callback for the state change of print job. 1840 * @permission ohos.permission.MANAGE_PRINT_JOB 1841 * @param { 'jobStateChange' } type - Indicates state change of printer. 1842 * @param { Callback<boolean> } callback - The callback function for state change of printer. 1843 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1844 * @throws { BusinessError } 202 - not system application 1845 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1846 * @syscap SystemCapability.Print.PrintFramework 1847 * @systemapi Hide this for inner system use. 1848 * @since 10 1849 */ 1850 function off(type: 'jobStateChange', callback?: Callback<boolean>): void; 1851 1852 /** 1853 * Register event callback for the information change of print extension. 1854 * @permission ohos.permission.MANAGE_PRINT_JOB 1855 * @param { 'extInfoChange' } type - Indicates information change of print extension. 1856 * @param { function } callback - The callback function for information change of print extension. 1857 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1858 * @throws { BusinessError } 202 - not system application 1859 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1860 * @syscap SystemCapability.Print.PrintFramework 1861 * @systemapi Hide this for inner system use. 1862 * @since 10 1863 */ 1864 function on(type: 'extInfoChange', callback: (extensionId: string, info: string) => void): void; 1865 1866 /** 1867 * Unregister event callback for the information change of print extension. 1868 * @permission ohos.permission.MANAGE_PRINT_JOB 1869 * @param { 'extInfoChange' } type - Indicates state change of printer. 1870 * @param { Callback<boolean> } callback - The callback function for state change of printer. 1871 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1872 * @throws { BusinessError } 202 - not system application 1873 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1874 * @syscap SystemCapability.Print.PrintFramework 1875 * @systemapi Hide this for inner system use. 1876 * @since 10 1877 */ 1878 function off(type: 'extInfoChange', callback?: Callback<boolean>): void; 1879 1880 /** 1881 * New printers have been found and notify Print SA. 1882 * @permission ohos.permission.MANAGE_PRINT_JOB 1883 * @param { Array<PrinterInfo> } printers - Indicates new arrived printer lists. 1884 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 1885 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1886 * @throws { BusinessError } 202 - not system application 1887 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1888 * @syscap SystemCapability.Print.PrintFramework 1889 * @systemapi Hide this for inner system use. 1890 * @since 10 1891 */ 1892 function addPrinters(printers: Array<PrinterInfo>, callback: AsyncCallback<void>): void; 1893 1894 /** 1895 * New printers have been found and notify Print SA. 1896 * @permission ohos.permission.MANAGE_PRINT_JOB 1897 * @param { Array<PrinterInfo> } printers - Indicates new arrived printer lists. 1898 * @returns { Promise<void> } the promise returned by the function. 1899 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1900 * @throws { BusinessError } 202 - not system application 1901 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1902 * @syscap SystemCapability.Print.PrintFramework 1903 * @systemapi Hide this for inner system use. 1904 * @since 10 1905 */ 1906 function addPrinters(printers: Array<PrinterInfo>): Promise<void>; 1907 1908 /** 1909 * Printers have been lost and notify Print SA. 1910 * @permission ohos.permission.MANAGE_PRINT_JOB 1911 * @param { Array<string> } printerIds - Indicates the lost printer lists. 1912 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 1913 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1914 * @throws { BusinessError } 202 - not system application 1915 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1916 * @syscap SystemCapability.Print.PrintFramework 1917 * @systemapi Hide this for inner system use. 1918 * @since 10 1919 */ 1920 function removePrinters(printerIds: Array<string>, callback: AsyncCallback<void>): void; 1921 1922 /** 1923 * Printers have been lost and notify Print SA. 1924 * @permission ohos.permission.MANAGE_PRINT_JOB 1925 * @param { Array<string> } printerIds - Indicates the lost printer lists. 1926 * @returns { Promise<void> } the promise returned by the function. 1927 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1928 * @throws { BusinessError } 202 - not system application 1929 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1930 * @syscap SystemCapability.Print.PrintFramework 1931 * @systemapi Hide this for inner system use. 1932 * @since 10 1933 */ 1934 function removePrinters(printerIds: Array<string>): Promise<void>; 1935 1936 /** 1937 * Update the information of the specific printers. 1938 * @permission ohos.permission.MANAGE_PRINT_JOB 1939 * @param { Array<PrinterInfo> } printers - Indicates to be updated printer lists. 1940 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 1941 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1942 * @throws { BusinessError } 202 - not system application 1943 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1944 * @syscap SystemCapability.Print.PrintFramework 1945 * @systemapi Hide this for inner system use. 1946 * @since 10 1947 */ 1948 function updatePrinters(printers: Array<PrinterInfo>, callback: AsyncCallback<void>): void; 1949 1950 /** 1951 * Update the information of the specific printers. 1952 * @permission ohos.permission.MANAGE_PRINT_JOB 1953 * @param { Array<PrinterInfo> } printers - Indicates to be updated printer lists. 1954 * @returns { Promise<void> } the promise returned by the function. 1955 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1956 * @throws { BusinessError } 202 - not system application 1957 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1958 * @syscap SystemCapability.Print.PrintFramework 1959 * @systemapi Hide this for inner system use. 1960 * @since 10 1961 */ 1962 function updatePrinters(printers: Array<PrinterInfo>): Promise<void>; 1963 1964 /** 1965 * Notify Print SA the state of printer has been changed. 1966 * @permission ohos.permission.MANAGE_PRINT_JOB 1967 * @param { string } printerId - Indicates id of the printer. 1968 * @param { PrinterState } state - Indicates state of the printer. 1969 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 1970 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1971 * @throws { BusinessError } 202 - not system application 1972 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1973 * @syscap SystemCapability.Print.PrintFramework 1974 * @systemapi Hide this for inner system use. 1975 * @since 10 1976 */ 1977 function updatePrinterState(printerId: string, state: PrinterState, callback: AsyncCallback<void>): void; 1978 1979 /** 1980 * Notify Print SA the state of printer has been changed. 1981 * @permission ohos.permission.MANAGE_PRINT_JOB 1982 * @param { string } printerId - Indicates id of the printer. 1983 * @param { PrinterState } state - Indicates state of the printer. 1984 * @returns { Promise<void> } the promise returned by the function. 1985 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1986 * @throws { BusinessError } 202 - not system application 1987 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1988 * @syscap SystemCapability.Print.PrintFramework 1989 * @systemapi Hide this for inner system use. 1990 * @since 10 1991 */ 1992 function updatePrinterState(printerId: string, state: PrinterState): Promise<void>; 1993 1994 /** 1995 * Notify Print SA the state of print job has been changed. 1996 * @permission ohos.permission.MANAGE_PRINT_JOB 1997 * @param { string} jobId - Indicates id of the print job. 1998 * @param { PrintJobState } state - Indicates new state of print job. 1999 * @param { PrintJobSubState } subState - Indicates sub state of print job. 2000 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 2001 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2002 * @throws { BusinessError } 202 - not system application 2003 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2004 * @syscap SystemCapability.Print.PrintFramework 2005 * @systemapi Hide this for inner system use. 2006 * @since 10 2007 */ 2008 function updatePrintJobState(jobId: string, state: PrintJobState, subState: PrintJobSubState, callback: AsyncCallback<void>): void; 2009 2010 /** 2011 * Notify Print SA the state of print job has been changed. 2012 * @permission ohos.permission.MANAGE_PRINT_JOB 2013 * @param { string} jobId - Indicates id of the print job. 2014 * @param { PrintJobState } state - Indicates new state of print job. 2015 * @param { PrintJobSubState } subState - Indicates sub state of print job. 2016 * @returns { Promise<void> } the promise returned by the function. 2017 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2018 * @throws { BusinessError } 202 - not system application 2019 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2020 * @syscap SystemCapability.Print.PrintFramework 2021 * @systemapi Hide this for inner system use. 2022 * @since 10 2023 */ 2024 function updatePrintJobState(jobId: string, state: PrintJobState, subState: PrintJobSubState): Promise<void>; 2025 2026 /** 2027 * Notify Print SA the state of print extension has been changed. 2028 * @permission ohos.permission.MANAGE_PRINT_JOB 2029 * @param { string } info - Indicates changed information of print extension. 2030 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 2031 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2032 * @throws { BusinessError } 202 - not system application 2033 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2034 * @syscap SystemCapability.Print.PrintFramework 2035 * @systemapi Hide this for inner system use. 2036 * @since 10 2037 */ 2038 function updateExtensionInfo(info: string, callback: AsyncCallback<void>): void; 2039 2040 /** 2041 * Notify Print SA the state of print extension has been changed. 2042 * @permission ohos.permission.MANAGE_PRINT_JOB 2043 * @param { string } info - Indicates changed information of print extension. 2044 * @returns { Promise<void> } the promise returned by the function. 2045 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2046 * @throws { BusinessError } 202 - not system application 2047 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2048 * @syscap SystemCapability.Print.PrintFramework 2049 * @systemapi Hide this for inner system use. 2050 * @since 10 2051 */ 2052 function updateExtensionInfo(info: string): Promise<void>; 2053 2054 /** 2055 * Get all the printJobs in the queue. 2056 * @permission ohos.permission.MANAGE_PRINT_JOB 2057 * @param { AsyncCallback<void> } callback - The callback function for handling the printJob list found. 2058 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2059 * @throws { BusinessError } 202 - not system application 2060 * @syscap SystemCapability.Print.PrintFramework 2061 * @systemapi Hide this for inner system use. 2062 * @since 10 2063 * @deprecated since 11 2064 * @useinstead print#queryPrintJobList 2065 */ 2066 function queryAllPrintJobs(callback: AsyncCallback<void>): void; 2067 2068 /** 2069 * Get all the printJobs in the queue. 2070 * @permission ohos.permission.MANAGE_PRINT_JOB 2071 * @returns { Promise<void> } the promise returned by the function. 2072 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2073 * @throws { BusinessError } 202 - not system application 2074 * @syscap SystemCapability.Print.PrintFramework 2075 * @systemapi Hide this for inner system use. 2076 * @since 10 2077 * @deprecated since 11 2078 * @useinstead print#queryPrintJobList 2079 */ 2080 function queryAllPrintJobs(): Promise<void>; 2081 2082 /** 2083 * Get all the printJobs in the queue. 2084 * @permission ohos.permission.MANAGE_PRINT_JOB 2085 * @param { AsyncCallback<Array<PrintJob>> } callback - The callback function for handling the printJob list found. 2086 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2087 * @throws { BusinessError } 202 - not system application 2088 * @syscap SystemCapability.Print.PrintFramework 2089 * @systemapi Hide this for inner system use. 2090 * @since 11 2091 */ 2092 function queryPrintJobList(callback: AsyncCallback<Array<PrintJob>>): void; 2093 2094 /** 2095 * Get all the printJobs in the queue. 2096 * @permission ohos.permission.MANAGE_PRINT_JOB 2097 * @returns { Promise<Array<PrintJob>> } the promise returned by the function. 2098 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2099 * @throws { BusinessError } 202 - not system application 2100 * @syscap SystemCapability.Print.PrintFramework 2101 * @systemapi Hide this for inner system use. 2102 * @since 11 2103 */ 2104 function queryPrintJobList(): Promise<Array<PrintJob>>; 2105 2106 /** 2107 * Get printJob by jobId. 2108 * @permission ohos.permission.MANAGE_PRINT_JOB 2109 * @param { string } jobId - Indicates id of the print job. 2110 * @param { AsyncCallback<PrintJob> } callback - The callback function for get printJob by jobId. 2111 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2112 * @throws { BusinessError } 202 - not system application 2113 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2114 * @syscap SystemCapability.Print.PrintFramework 2115 * @systemapi Hide this for inner system use. 2116 * @since 11 2117 */ 2118 function queryPrintJobById(jobId: string, callback: AsyncCallback<PrintJob>): void; 2119 2120 /** 2121 * Get printJob by jobId. 2122 * @permission ohos.permission.MANAGE_PRINT_JOB 2123 * @param { string } jobId - Indicates id of the print job. 2124 * @returns { Promise<PrintJob> } the promise returned by the function. 2125 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2126 * @throws { BusinessError } 202 - not system application 2127 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2128 * @syscap SystemCapability.Print.PrintFramework 2129 * @systemapi Hide this for inner system use. 2130 * @since 11 2131 */ 2132 function queryPrintJobById(jobId: string): Promise<PrintJob>; 2133 2134 /** 2135 * Start getting print file. 2136 * @permission ohos.permission.MANAGE_PRINT_JOB 2137 * @param { string } jobId - Indicates id of the print job. 2138 * @param { PrintAttributes } printAttributes - Indicates print attributes. 2139 * @param { number } fd - Indicates print file fd. 2140 * @param { Callback<PrintFileCreationState> } onFileStateChanged - The callback function for update the file state. 2141 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2142 * @throws { BusinessError } 202 - not system application 2143 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2144 * @syscap SystemCapability.Print.PrintFramework 2145 * @systemapi Hide this for inner system use. 2146 * @since 11 2147 */ 2148 function startGettingPrintFile(jobId: string, printAttributes: PrintAttributes, fd: number, 2149 onFileStateChanged: Callback<PrintFileCreationState>): void; 2150 2151 /** 2152 * Notify print service the information. 2153 * @permission ohos.permission.MANAGE_PRINT_JOB 2154 * @param { string } jobId - Indicates id of the print job. 2155 * @param { 'spooler_closed_for_cancelled' | 'spooler_closed_for_started' } type - Indicates notify information. 2156 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 2157 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2158 * @throws { BusinessError } 202 - not system application 2159 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2160 * @syscap SystemCapability.Print.PrintFramework 2161 * @systemapi Hide this for inner system use. 2162 * @since 11 2163 */ 2164 function notifyPrintService(jobId: string, type: 'spooler_closed_for_cancelled' | 'spooler_closed_for_started', callback: AsyncCallback<void>): void; 2165 2166 /** 2167 * Notify print service the information. 2168 * @permission ohos.permission.MANAGE_PRINT_JOB 2169 * @param { string } jobId - Indicates id of the print job. 2170 * @param { 'spooler_closed_for_cancelled' | 'spooler_closed_for_started' } type - Indicates notify information. 2171 * @returns { Promise<void> } the promise returned by the function. 2172 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2173 * @throws { BusinessError } 202 - not system application 2174 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2175 * @syscap SystemCapability.Print.PrintFramework 2176 * @systemapi Hide this for inner system use. 2177 * @since 11 2178 */ 2179 function notifyPrintService(jobId: string, type: 'spooler_closed_for_cancelled' | 'spooler_closed_for_started'): Promise<void>; 2180 2181 /** 2182 * Get all added printers. 2183 * @permission ohos.permission.MANAGE_PRINT_JOB 2184 * @returns { Promise<Array<string>> } the promise returned by the function. 2185 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2186 * @throws { BusinessError } 202 - not system application 2187 * @syscap SystemCapability.Print.PrintFramework 2188 * @systemapi Hide this for inner system use. 2189 * @since 12 2190 */ 2191 function getAddedPrinters(): Promise<Array<string>>; 2192 2193 /** 2194 * Get printer info by printer id. 2195 * @permission ohos.permission.MANAGE_PRINT_JOB 2196 * @param { string } printerId - Indicates id of the printer. 2197 * @returns { Promise<PrinterInfo> } the promise returned by the function. 2198 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2199 * @throws { BusinessError } 202 - not system application 2200 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2201 * @syscap SystemCapability.Print.PrintFramework 2202 * @systemapi Hide this for inner system use. 2203 * @since 12 2204 */ 2205 function getPrinterInfoById(printerId: string): Promise<PrinterInfo>; 2206 2207 /** 2208 * Notify print service of application event. 2209 * @permission ohos.permission.MANAGE_PRINT_JOB 2210 * @param { ApplicationEvent } event - Indicates the event to be notified. 2211 * @returns { Promise<void> } the promise returned by the function. 2212 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2213 * @throws { BusinessError } 202 - not system application 2214 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2215 * @syscap SystemCapability.Print.PrintFramework 2216 * @systemapi Hide this for inner system use. 2217 * @since 12 2218 */ 2219 function notifyPrintServiceEvent(event: ApplicationEvent): Promise<void>; 2220} 2221 2222export default print;