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 16import type { AsyncCallback, Callback } from './@ohos.base'; 17 18/** 19 * System print 20 * 21 * @namespace print 22 * @syscap SystemCapability.Print.PrintFramework 23 * @since 10 24 */ 25declare namespace print { 26 27 /** 28 * PrintTask provide event callback. 29 * @interface PrintTask 30 * @syscap SystemCapability.Print.PrintFramework 31 * @since 10 32 */ 33 interface PrintTask { 34 /** 35 * Register event callback when the current print task is in process. 36 * @permission ohos.permission.PRINT 37 * @param { 'block' } type - Indicates the print task has been blocked. 38 * @param { Callback<void> } callback - The callback function for print task change event 39 * @throws { BusinessError } 201 - the application does not have permission to call this function. 40 * @syscap SystemCapability.Print.PrintFramework 41 * @since 10 42 */ 43 on(type: 'block', callback: Callback<void>): void; 44 45 /** 46 * Register event callback when the current print task is in process. 47 * @permission ohos.permission.PRINT 48 * @param { 'succeed' } type - Indicates the print task succeed. 49 * @param { Callback<void> } callback - The callback function for print task change event 50 * @throws { BusinessError } 201 - the application does not have permission to call this function. 51 * @syscap SystemCapability.Print.PrintFramework 52 * @since 10 53 */ 54 on(type: 'succeed', callback: Callback<void>): void; 55 56 /** 57 * Register event callback when the current print task is in process. 58 * @permission ohos.permission.PRINT 59 * @param { 'fail' } type - Indicates the print task has completed with failure. 60 * @param { Callback<void> } callback - The callback function for print task change event 61 * @throws { BusinessError } 201 - the application does not have permission to call this function. 62 * @syscap SystemCapability.Print.PrintFramework 63 * @since 10 64 */ 65 on(type: 'fail', callback: Callback<void>): void; 66 67 /** 68 * Register event callback when the current print task is in process. 69 * @permission ohos.permission.PRINT 70 * @param { 'cancel' } type - Indicates the print task has been cancelled. 71 * @param { Callback<void> } callback - The callback function for print task change event 72 * @throws { BusinessError } 201 - the application does not have permission to call this function. 73 * @syscap SystemCapability.Print.PrintFramework 74 * @since 10 75 */ 76 on(type: 'cancel', callback: Callback<void>): void; 77 78 /** 79 * Unregister event callback when the current print task is in process. 80 * @permission ohos.permission.PRINT 81 * @param { 'block' } type - Indicates the print task has been blocked. 82 * @param { Callback<void> } callback - The callback function for print task change event 83 * @throws { BusinessError } 201 - the application does not have permission to call this function. 84 * @syscap SystemCapability.Print.PrintFramework 85 * @since 10 86 */ 87 off(type: 'block', callback?: Callback<void>): void; 88 89 /** 90 * Unregister event callback when the current print task is in process. 91 * @permission ohos.permission.PRINT 92 * @param { 'succeed' } type - Indicates the print task succeed. 93 * @param { Callback<void> } callback - The callback function for print task change event 94 * @throws { BusinessError } 201 - the application does not have permission to call this function. 95 * @syscap SystemCapability.Print.PrintFramework 96 * @since 10 97 */ 98 off(type: 'succeed', 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 { 'fail' } type - Indicates the print task has completed with failure. 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 * @syscap SystemCapability.Print.PrintFramework 107 * @since 10 108 */ 109 off(type: 'fail', callback?: Callback<void>): void; 110 111 /** 112 * Unregister event callback when the current print task is in process. 113 * @permission ohos.permission.PRINT 114 * @param { 'cancel' } type - Indicates the print task has been cancelled. 115 * @param { Callback<void> } callback - The callback function for print task change event 116 * @throws { BusinessError } 201 - the application does not have permission to call this function. 117 * @syscap SystemCapability.Print.PrintFramework 118 * @since 10 119 */ 120 off(type: 'cancel', callback?: Callback<void>): void; 121 } 122 123 /** 124 * Start new print task for App. 125 * @permission ohos.permission.PRINT 126 * @param { Array<string> } files - Indicates the filepath list to be printed. Only pdf and picture filetype are supported. 127 * @param { AsyncCallback<PrintTask> } callback - The callback function for print task. 128 * @throws { BusinessError } 201 - the application does not have permission to call this function. 129 * @syscap SystemCapability.Print.PrintFramework 130 * @since 10 131 */ 132 function print(files: Array<string>, callback: AsyncCallback<PrintTask>): void; 133 134 /** 135 * Start new print task for App. 136 * @permission ohos.permission.PRINT 137 * @param { Array<string> } files - Indicates the filepath list to be printed. Only pdf and picture filetype are supported. 138 * @returns { Promise<PrintTask> } the promise returned by the function. 139 * @throws { BusinessError } 201 - the application does not have permission to call this function. 140 * @syscap SystemCapability.Print.PrintFramework 141 * @since 10 142 */ 143 function print(files: Array<string>): Promise<PrintTask>; 144 145 /** 146 * defines print margin. 147 * @typedef PrintMargin 148 * @syscap SystemCapability.Print.PrintFramework 149 * @systemapi Hide this for inner system use. 150 * @since 10 151 */ 152 interface PrintMargin { 153 /** 154 * Top margin. 155 * @type { ?number } 156 * @syscap SystemCapability.Print.PrintFramework 157 * @systemapi 158 * @since 10 159 */ 160 top?: number; 161 162 /** 163 * Bottom margin. 164 * @type { ?number } 165 * @syscap SystemCapability.Print.PrintFramework 166 * @systemapi 167 * @since 10 168 */ 169 bottom?: number; 170 171 /** 172 * Left margin. 173 * @type { ?number } 174 * @syscap SystemCapability.Print.PrintFramework 175 * @systemapi 176 * @since 10 177 */ 178 left?: number; 179 180 /** 181 * Right margin. 182 * @type { ?number } 183 * @syscap SystemCapability.Print.PrintFramework 184 * @systemapi 185 * @since 10 186 */ 187 right?: number; 188 } 189 190 /** 191 * defines print range. 192 * @typedef PrinterRange 193 * @syscap SystemCapability.Print.PrintFramework 194 * @systemapi Hide this for inner system use. 195 * @since 10 196 */ 197 interface PrinterRange { 198 /** 199 * Start page of sequence. 200 * @type { ?number } 201 * @syscap SystemCapability.Print.PrintFramework 202 * @systemapi 203 * @since 10 204 */ 205 startPage?: number; 206 207 /** 208 * End page of sequence. 209 * @type { ?number } 210 * @syscap SystemCapability.Print.PrintFramework 211 * @systemapi 212 * @since 10 213 */ 214 endPage?: number; 215 216 /** 217 * Discrete page of sequence. 218 * @type { ?Array<number> } 219 * @syscap SystemCapability.Print.PrintFramework 220 * @systemapi 221 * @since 10 222 */ 223 pages?: Array<number>; 224 } 225 226 /** 227 * defines print preview attribute. 228 * @typedef PreviewAttribute 229 * @syscap SystemCapability.Print.PrintFramework 230 * @systemapi Hide this for inner system use. 231 * @since 10 232 */ 233 interface PreviewAttribute { 234 /** 235 * Preview page range. 236 * @type { PrinterRange } 237 * @syscap SystemCapability.Print.PrintFramework 238 * @systemapi 239 * @since 10 240 */ 241 previewRange: PrinterRange; 242 243 /** 244 * Preview file result. 245 * @type { ?number } 246 * @syscap SystemCapability.Print.PrintFramework 247 * @systemapi 248 * @since 10 249 */ 250 result?: number; 251 } 252 253 /** 254 * defines print resolution. 255 * @typedef PrintResolution 256 * @syscap SystemCapability.Print.PrintFramework 257 * @systemapi Hide this for inner system use. 258 * @since 10 259 */ 260 interface PrintResolution { 261 /** 262 * Resolution id. 263 * @type { string } 264 * @syscap SystemCapability.Print.PrintFramework 265 * @systemapi 266 * @since 10 267 */ 268 id: string; 269 270 /** 271 * Horizontal DPI. 272 * @type { number } 273 * @syscap SystemCapability.Print.PrintFramework 274 * @systemapi 275 * @since 10 276 */ 277 horizontalDpi: number; 278 279 /** 280 * Vertical DPI. 281 * @type { number } 282 * @syscap SystemCapability.Print.PrintFramework 283 * @systemapi 284 * @since 10 285 */ 286 verticalDpi: number; 287 } 288 289 /** 290 * defines print page size. 291 * @typedef PrintPageSize 292 * @syscap SystemCapability.Print.PrintFramework 293 * @systemapi Hide this for inner system use. 294 * @since 10 295 */ 296 interface PrintPageSize { 297 /** 298 * Page size id. 299 * @type { string } 300 * @syscap SystemCapability.Print.PrintFramework 301 * @systemapi 302 * @since 10 303 */ 304 id: string; 305 306 /** 307 * Page size name. 308 * @type { string } 309 * @syscap SystemCapability.Print.PrintFramework 310 * @systemapi 311 * @since 10 312 */ 313 name: string; 314 315 /** 316 * Unit: millimeter width. 317 * @type { number } 318 * @syscap SystemCapability.Print.PrintFramework 319 * @systemapi 320 * @since 10 321 */ 322 width: number; 323 324 /** 325 * Unit: millimeter height. 326 * @type { number } 327 * @syscap SystemCapability.Print.PrintFramework 328 * @systemapi 329 * @since 10 330 */ 331 height: number; 332 } 333 334 /** 335 * defines print capability. 336 * @typedef PrinterCapability 337 * @syscap SystemCapability.Print.PrintFramework 338 * @systemapi Hide this for inner system use. 339 * @since 10 340 */ 341 interface PrinterCapability { 342 /** 343 * Color mode. 344 * @type { number } 345 * @syscap SystemCapability.Print.PrintFramework 346 * @systemapi 347 * @since 10 348 */ 349 colorMode: number; 350 351 /** 352 * Duplex mode. 353 * @type { number } 354 * @syscap SystemCapability.Print.PrintFramework 355 * @systemapi 356 * @since 10 357 */ 358 duplexMode: number; 359 360 /** 361 * The page size list supported by the printer. 362 * @type { Array<PrintPageSize> } 363 * @syscap SystemCapability.Print.PrintFramework 364 * @systemapi 365 * @since 10 366 */ 367 pageSize: Array<PrintPageSize>; 368 369 /** 370 * The resolution list supported by the printer. 371 * @type { ?Array<PrintResolution> } 372 * @syscap SystemCapability.Print.PrintFramework 373 * @systemapi 374 * @since 10 375 */ 376 resolution?: Array<PrintResolution>; 377 378 /** 379 * Min margin of printer. 380 * @type { ?PrintMargin } 381 * @syscap SystemCapability.Print.PrintFramework 382 * @systemapi 383 * @since 10 384 */ 385 minMargin?: PrintMargin; 386 } 387 388 /** 389 * defines print info. 390 * @typedef PrinterInfo 391 * @syscap SystemCapability.Print.PrintFramework 392 * @systemapi Hide this for inner system use. 393 * @since 10 394 */ 395 interface PrinterInfo { 396 /** 397 * Printer id. 398 * @type { string } 399 * @syscap SystemCapability.Print.PrintFramework 400 * @systemapi 401 * @since 10 402 */ 403 printerId: string; 404 405 /** 406 * Printer name. 407 * @type { string } 408 * @syscap SystemCapability.Print.PrintFramework 409 * @systemapi 410 * @since 10 411 */ 412 printerName: string; 413 414 /** 415 * Current printer state. 416 * @type { PrinterState } 417 * @syscap SystemCapability.Print.PrintFramework 418 * @systemapi 419 * @since 10 420 */ 421 printerState: PrinterState; 422 423 /** 424 * Resource id of printer icon. 425 * @type { ?number } 426 * @syscap SystemCapability.Print.PrintFramework 427 * @systemapi 428 * @since 10 429 */ 430 printerIcon?: number; 431 432 /** 433 * Printer description. 434 * @type { ?string } 435 * @syscap SystemCapability.Print.PrintFramework 436 * @systemapi 437 * @since 10 438 */ 439 description?: string; 440 441 /** 442 * Printer capability. 443 * @type { ?PrinterCapability } 444 * @syscap SystemCapability.Print.PrintFramework 445 * @systemapi 446 * @since 10 447 */ 448 capability?: PrinterCapability; 449 450 /** 451 * JSON object string. 452 * @type { ?Object } 453 * @syscap SystemCapability.Print.PrintFramework 454 * @systemapi 455 * @since 10 456 */ 457 options? :Object; 458 } 459 460 /** 461 * defines print job. 462 * @typedef PrintJob 463 * @syscap SystemCapability.Print.PrintFramework 464 * @systemapi Hide this for inner system use. 465 * @since 10 466 */ 467 interface PrintJob { 468 /** 469 * Document fd list to be printed. 470 * @type { Array<number> } 471 * @syscap SystemCapability.Print.PrintFramework 472 * @systemapi 473 * @since 10 474 */ 475 fdList: Array<number>; 476 477 /** 478 * Job id. 479 * @type { string } 480 * @syscap SystemCapability.Print.PrintFramework 481 * @systemapi 482 * @since 10 483 */ 484 jobId: string; 485 486 /** 487 * Printer id to take charge of printing. 488 * @type { string } 489 * @syscap SystemCapability.Print.PrintFramework 490 * @systemapi 491 * @since 10 492 */ 493 printerId: string; 494 495 /** 496 * Current print job state. 497 * @type { PrintJobState } 498 * @syscap SystemCapability.Print.PrintFramework 499 * @systemapi 500 * @since 10 501 */ 502 jobState: PrintJobState; 503 504 /** 505 * Copies of document list. 506 * @type { number } 507 * @syscap SystemCapability.Print.PrintFramework 508 * @systemapi 509 * @since 10 510 */ 511 copyNumber: number; 512 513 /** 514 * Range size to be printed. 515 * @type { PrinterRange } 516 * @syscap SystemCapability.Print.PrintFramework 517 * @systemapi 518 * @since 10 519 */ 520 pageRange: PrinterRange; 521 522 /** 523 * Sequential print. 524 * @type { boolean } 525 * @syscap SystemCapability.Print.PrintFramework 526 * @systemapi 527 * @since 10 528 */ 529 isSequential: boolean; 530 531 /** 532 * The selected page size. 533 * @type { PrintPageSize } 534 * @syscap SystemCapability.Print.PrintFramework 535 * @systemapi 536 * @since 10 537 */ 538 pageSize: PrintPageSize; 539 540 /** 541 * Vertical printing. 542 * @type { boolean } 543 * @syscap SystemCapability.Print.PrintFramework 544 * @systemapi 545 * @since 10 546 */ 547 isLandscape: boolean; 548 549 /** 550 * Color mode. 551 * @type { number } 552 * @syscap SystemCapability.Print.PrintFramework 553 * @systemapi 554 * @since 10 555 */ 556 colorMode: number; 557 558 /** 559 * Duplex mode. 560 * @type { number } 561 * @syscap SystemCapability.Print.PrintFramework 562 * @systemapi 563 * @since 10 564 */ 565 duplexMode: number; 566 567 /** 568 * Current margin setting. 569 * @type { ?PrintMargin } 570 * @syscap SystemCapability.Print.PrintFramework 571 * @systemapi 572 * @since 10 573 */ 574 margin?: PrintMargin; 575 576 /** 577 * Preview setting. 578 * @type { ?PreviewAttribute } 579 * @syscap SystemCapability.Print.PrintFramework 580 * @systemapi 581 * @since 10 582 */ 583 preview?: PreviewAttribute; 584 585 /** 586 * JSON object string. 587 * @type { ?Object } 588 * @syscap SystemCapability.Print.PrintFramework 589 * @systemapi 590 * @since 10 591 */ 592 options? :Object; 593 } 594 595 /** 596 * Enumeration of Printer State. 597 * @enum { number } PrinterState 598 * @syscap SystemCapability.Print.PrintFramework 599 * @systemapi Hide this for inner system use. 600 * @since 10 601 */ 602 enum PrinterState { 603 /** 604 * New printers arrival. 605 * @syscap SystemCapability.Print.PrintFramework 606 * @systemapi 607 * @since 10 608 */ 609 PRINTER_ADDED = 0, 610 611 /** 612 * Printer lost. 613 * @syscap SystemCapability.Print.PrintFramework 614 * @systemapi 615 * @since 10 616 */ 617 PRINTER_REMOVED = 1, 618 619 /** 620 * Printer update. 621 * @syscap SystemCapability.Print.PrintFramework 622 * @systemapi 623 * @since 10 624 */ 625 PRINTER_CAPABILITY_UPDATED = 2, 626 627 /** 628 * Printer has been connected. 629 * @syscap SystemCapability.Print.PrintFramework 630 * @systemapi 631 * @since 10 632 */ 633 PRINTER_CONNECTED = 3, 634 635 /** 636 * Printer has been disconnected. 637 * @syscap SystemCapability.Print.PrintFramework 638 * @systemapi 639 * @since 10 640 */ 641 PRINTER_DISCONNECTED = 4, 642 643 /** 644 * Printer is working. 645 * @syscap SystemCapability.Print.PrintFramework 646 * @systemapi 647 * @since 10 648 */ 649 PRINTER_RUNNING = 5, 650 } 651 652 /** 653 * Enumeration of Print Job State. 654 * @enum { number } PrintJobState 655 * @syscap SystemCapability.Print.PrintFramework 656 * @systemapi Hide this for inner system use. 657 * @since 10 658 */ 659 enum PrintJobState { 660 /** 661 * Initial state of print job. 662 * @syscap SystemCapability.Print.PrintFramework 663 * @systemapi 664 * @since 10 665 */ 666 PRINT_JOB_PREPARE = 0, 667 668 /** 669 * Deliver print job to the printer. 670 * @syscap SystemCapability.Print.PrintFramework 671 * @systemapi 672 * @since 10 673 */ 674 PRINT_JOB_QUEUED = 1, 675 676 /** 677 * Executing print job. 678 * @syscap SystemCapability.Print.PrintFramework 679 * @systemapi 680 * @since 10 681 */ 682 PRINT_JOB_RUNNING = 2, 683 684 /** 685 * Print job has been blocked. 686 * @syscap SystemCapability.Print.PrintFramework 687 * @systemapi 688 * @since 10 689 */ 690 PRINT_JOB_BLOCKED = 3, 691 692 /** 693 * Print job completed. 694 * @syscap SystemCapability.Print.PrintFramework 695 * @systemapi 696 * @since 10 697 */ 698 PRINT_JOB_COMPLETED = 4, 699 } 700 701 /** 702 * Enumeration of Print Job Sub State. 703 * @enum { number } PrintJobSubState 704 * @syscap SystemCapability.Print.PrintFramework 705 * @systemapi Hide this for inner system use. 706 * @since 10 707 */ 708 enum PrintJobSubState { 709 /** 710 * Print job succeed. 711 * @syscap SystemCapability.Print.PrintFramework 712 * @systemapi 713 * @since 10 714 */ 715 PRINT_JOB_COMPLETED_SUCCESS = 0, 716 717 /** 718 * Print job fail. 719 * @syscap SystemCapability.Print.PrintFramework 720 * @systemapi 721 * @since 10 722 */ 723 PRINT_JOB_COMPLETED_FAILED = 1, 724 725 /** 726 * Print job has been cancelled. 727 * @syscap SystemCapability.Print.PrintFramework 728 * @systemapi 729 * @since 10 730 */ 731 PRINT_JOB_COMPLETED_CANCELLED = 2, 732 733 /** 734 * Print job has been corrupted. 735 * @syscap SystemCapability.Print.PrintFramework 736 * @systemapi 737 * @since 10 738 */ 739 PRINT_JOB_COMPLETED_FILE_CORRUPTED = 3, 740 741 /** 742 * Print is offline. 743 * @syscap SystemCapability.Print.PrintFramework 744 * @systemapi 745 * @since 10 746 */ 747 PRINT_JOB_BLOCK_OFFLINE = 4, 748 749 /** 750 * Print is occupied by other process. 751 * @syscap SystemCapability.Print.PrintFramework 752 * @systemapi 753 * @since 10 754 */ 755 PRINT_JOB_BLOCK_BUSY = 5, 756 757 /** 758 * Print job has been cancelled. 759 * @syscap SystemCapability.Print.PrintFramework 760 * @systemapi 761 * @since 10 762 */ 763 PRINT_JOB_BLOCK_CANCELLED = 6, 764 765 /** 766 * Print out of paper. 767 * @syscap SystemCapability.Print.PrintFramework 768 * @systemapi 769 * @since 10 770 */ 771 PRINT_JOB_BLOCK_OUT_OF_PAPER = 7, 772 773 /** 774 * Print out of ink. 775 * @syscap SystemCapability.Print.PrintFramework 776 * @systemapi 777 * @since 10 778 */ 779 PRINT_JOB_BLOCK_OUT_OF_INK = 8, 780 781 /** 782 * Print out of toner. 783 * @syscap SystemCapability.Print.PrintFramework 784 * @systemapi 785 * @since 10 786 */ 787 PRINT_JOB_BLOCK_OUT_OF_TONER = 9, 788 789 /** 790 * Print paper jam. 791 * @syscap SystemCapability.Print.PrintFramework 792 * @systemapi 793 * @since 10 794 */ 795 PRINT_JOB_BLOCK_JAMMED = 10, 796 797 /** 798 * Print cover open. 799 * @syscap SystemCapability.Print.PrintFramework 800 * @systemapi 801 * @since 10 802 */ 803 PRINT_JOB_BLOCK_DOOR_OPEN = 11, 804 805 /** 806 * Print service request. 807 * @syscap SystemCapability.Print.PrintFramework 808 * @systemapi 809 * @since 10 810 */ 811 PRINT_JOB_BLOCK_SERVICE_REQUEST = 12, 812 813 /** 814 * Print low on ink. 815 * @syscap SystemCapability.Print.PrintFramework 816 * @systemapi 817 * @since 10 818 */ 819 PRINT_JOB_BLOCK_LOW_ON_INK = 13, 820 821 /** 822 * Print low on toner. 823 * @syscap SystemCapability.Print.PrintFramework 824 * @systemapi 825 * @since 10 826 */ 827 PRINT_JOB_BLOCK_LOW_ON_TONER = 14, 828 829 /** 830 * Print really low on ink. 831 * @syscap SystemCapability.Print.PrintFramework 832 * @systemapi 833 * @since 10 834 */ 835 PRINT_JOB_BLOCK_REALLY_LOW_ON_INK = 15, 836 837 /** 838 * Print bad certification. 839 * @syscap SystemCapability.Print.PrintFramework 840 * @systemapi 841 * @since 10 842 */ 843 PRINT_JOB_BLOCK_BAD_CERTIFICATE = 16, 844 845 /** 846 * Print unknown issue. 847 * @syscap SystemCapability.Print.PrintFramework 848 * @systemapi 849 * @since 10 850 */ 851 PRINT_JOB_BLOCK_UNKNOWN = 99, 852 } 853 854 /** 855 * Enumeration of Print error Code. 856 * @enum { number } PrintErrorCode 857 * @syscap SystemCapability.Print.PrintFramework 858 * @systemapi Hide this for inner system use. 859 * @since 10 860 */ 861 enum PrintErrorCode { 862 /** 863 * No error. 864 * @syscap SystemCapability.Print.PrintFramework 865 * @systemapi 866 * @since 10 867 */ 868 E_PRINT_NONE = 0, 869 870 /** 871 * No permission. 872 * @syscap SystemCapability.Print.PrintFramework 873 * @systemapi 874 * @since 10 875 */ 876 E_PRINT_NO_PERMISSION = 201, 877 878 /** 879 * Invalid parameter. 880 * @syscap SystemCapability.Print.PrintFramework 881 * @systemapi 882 * @since 10 883 */ 884 E_PRINT_INVALID_PARAMETER = 401, 885 886 /** 887 * Generic failure of print. 888 * @syscap SystemCapability.Print.PrintFramework 889 * @systemapi 890 * @since 10 891 */ 892 E_PRINT_GENERIC_FAILURE = 13100001, 893 894 /** 895 * RPC failure. 896 * @syscap SystemCapability.Print.PrintFramework 897 * @systemapi 898 * @since 10 899 */ 900 E_PRINT_RPC_FAILURE = 13100002, 901 902 /** 903 * Failure of print service. 904 * @syscap SystemCapability.Print.PrintFramework 905 * @systemapi 906 * @since 10 907 */ 908 E_PRINT_SERVER_FAILURE = 13100003, 909 910 /** 911 * Invalid print extension. 912 * @syscap SystemCapability.Print.PrintFramework 913 * @systemapi 914 * @since 10 915 */ 916 E_PRINT_INVALID_EXTENSION = 13100004, 917 918 /** 919 * Invalid printer. 920 * @syscap SystemCapability.Print.PrintFramework 921 * @systemapi 922 * @since 10 923 */ 924 E_PRINT_INVALID_PRINTER = 13100005, 925 926 /** 927 * Invalid print job. 928 * @syscap SystemCapability.Print.PrintFramework 929 * @systemapi 930 * @since 10 931 */ 932 E_PRINT_INVALID_PRINT_JOB = 13100006, 933 934 /** 935 * File i/o error. 936 * @syscap SystemCapability.Print.PrintFramework 937 * @systemapi 938 * @since 10 939 */ 940 E_PRINT_FILE_IO = 13100007, 941 } 942 943 /** 944 * defines print ExtensionInfo. 945 * @typedef PrinterExtensionInfo 946 * @syscap SystemCapability.Print.PrintFramework 947 * @systemapi Hide this for inner system use. 948 * @since 10 949 */ 950 interface PrinterExtensionInfo { 951 /** 952 * Extension id of printer extension. 953 * @syscap SystemCapability.Print.PrintFramework 954 * @systemapi 955 * @since 10 956 */ 957 extensionId: string; 958 959 /** 960 * Vendor id of extension. 961 * @syscap SystemCapability.Print.PrintFramework 962 * @systemapi 963 * @since 10 964 */ 965 vendorId: string; 966 967 /** 968 * Vendor name. 969 * @syscap SystemCapability.Print.PrintFramework 970 * @systemapi 971 * @since 10 972 */ 973 vendorName: string; 974 975 /** 976 * Vendor icon. 977 * @syscap SystemCapability.Print.PrintFramework 978 * @systemapi 979 * @since 10 980 */ 981 vendorIcon: number; 982 983 /** 984 * Version of current printer extension. 985 * @syscap SystemCapability.Print.PrintFramework 986 * @systemapi 987 * @since 10 988 */ 989 version: string; 990 } 991 992 /** 993 * Get all printer extension installed. 994 * @permission ohos.permission.MANAGE_PRINT_JOB 995 * @param { AsyncCallback<Array<PrinterExtensionInfo>> } callback - The callback function for handling the extension list found. 996 * @throws { BusinessError } 201 - the application does not have permission to call this function. 997 * @throws { BusinessError } 202 - not system application 998 * @syscap SystemCapability.Print.PrintFramework 999 * @systemapi Hide this for inner system use. 1000 * @since 10 1001 */ 1002 function queryAllPrinterExtensionInfos(callback: AsyncCallback<Array<PrinterExtensionInfo>>): void; 1003 1004 /** 1005 * Get all printer extension installed. 1006 * @permission ohos.permission.MANAGE_PRINT_JOB 1007 * @returns { Promise<Array<PrinterExtensionInfo>> } the promise returned by the function. 1008 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1009 * @throws { BusinessError } 202 - not system application 1010 * @syscap SystemCapability.Print.PrintFramework 1011 * @systemapi Hide this for inner system use. 1012 * @since 10 1013 */ 1014 function queryAllPrinterExtensionInfos(): Promise<Array<PrinterExtensionInfo>>; 1015 1016 /** 1017 * Load the specific printer extension and start to discover printer. 1018 * @permission ohos.permission.MANAGE_PRINT_JOB 1019 * @param { Array<string> } extensionList - Indicates the list of printer extension. 1020 * empty list of extensionList Indicates to find printer with all installed extension. 1021 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 1022 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1023 * @throws { BusinessError } 202 - not system application 1024 * @syscap SystemCapability.Print.PrintFramework 1025 * @systemapi Hide this for inner system use. 1026 * @since 10 1027 */ 1028 function startDiscoverPrinter(extensionList: Array<string>, callback: AsyncCallback<void>): void; 1029 1030 /** 1031 * Load the specific printer extension and start to discover printer. 1032 * @permission ohos.permission.MANAGE_PRINT_JOB 1033 * @param { Array<string> } extensionList - Indicates the list of printer extension. 1034 * empty list of extensionList Indicates to find printer with all installed extension. 1035 * @returns { Promise<void> } the promise returned by the function. 1036 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1037 * @throws { BusinessError } 202 - not system application 1038 * @syscap SystemCapability.Print.PrintFramework 1039 * @systemapi Hide this for inner system use. 1040 * @since 10 1041 */ 1042 function startDiscoverPrinter(extensionList: Array<string>): Promise<void>; 1043 1044 /** 1045 * Stop discovering the printer with specific printer extension. 1046 * @permission ohos.permission.MANAGE_PRINT_JOB 1047 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 1048 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1049 * @throws { BusinessError } 202 - not system application 1050 * @syscap SystemCapability.Print.PrintFramework 1051 * @systemapi Hide this for inner system use. 1052 * @since 10 1053 */ 1054 function stopDiscoverPrinter(callback: AsyncCallback<void>): void; 1055 1056 /** 1057 * Stop discovering the printer with specific printer extension. 1058 * @permission ohos.permission.MANAGE_PRINT_JOB 1059 * @returns { Promise<void> } the promise returned by the function. 1060 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1061 * @throws { BusinessError } 202 - not system application 1062 * @syscap SystemCapability.Print.PrintFramework 1063 * @systemapi Hide this for inner system use. 1064 * @since 10 1065 */ 1066 function stopDiscoverPrinter(): Promise<void>; 1067 1068 /** 1069 * Connect the specific printer. 1070 * @permission ohos.permission.MANAGE_PRINT_JOB 1071 * @param { string } printerId - Indicates id of the printer. 1072 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 1073 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1074 * @throws { BusinessError } 202 - not system application 1075 * @syscap SystemCapability.Print.PrintFramework 1076 * @systemapi Hide this for inner system use. 1077 * @since 10 1078 */ 1079 function connectPrinter(printerId: string, callback: AsyncCallback<void>): void; 1080 1081 /** 1082 * Connect the specific printer. 1083 * @permission ohos.permission.MANAGE_PRINT_JOB 1084 * @param { string } printerId - Indicates id of the printer. 1085 * @returns { Promise<void> } the promise returned by the function. 1086 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1087 * @throws { BusinessError } 202 - not system application 1088 * @syscap SystemCapability.Print.PrintFramework 1089 * @systemapi Hide this for inner system use. 1090 * @since 10 1091 */ 1092 function connectPrinter(printerId: string): Promise<void>; 1093 1094 /** 1095 * Disconnect the specific printer. 1096 * @permission ohos.permission.MANAGE_PRINT_JOB 1097 * @param { string } printerId - Indicates id of the printer. 1098 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 1099 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1100 * @throws { BusinessError } 202 - not system application 1101 * @syscap SystemCapability.Print.PrintFramework 1102 * @systemapi Hide this for inner system use. 1103 * @since 10 1104 */ 1105 function disconnectPrinter(printerId: string, callback: AsyncCallback<void>): void; 1106 1107 /** 1108 * Disconnect the specific printer. 1109 * @permission ohos.permission.MANAGE_PRINT_JOB 1110 * @param { string } printerId - Indicates id of the printer. 1111 * @returns { Promise<void> } the promise returned by the function. 1112 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1113 * @throws { BusinessError } 202 - not system application 1114 * @syscap SystemCapability.Print.PrintFramework 1115 * @systemapi Hide this for inner system use. 1116 * @since 10 1117 */ 1118 function disconnectPrinter(printerId: string): Promise<void>; 1119 1120 /** 1121 * Query capability for the specific printer. 1122 * @permission ohos.permission.MANAGE_PRINT_JOB 1123 * @param { string } printerId - Indicates id of the printer. 1124 * @param { AsyncCallback<void> } callback - The callback function for capability from printer. 1125 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1126 * @throws { BusinessError } 202 - not system application 1127 * @syscap SystemCapability.Print.PrintFramework 1128 * @systemapi Hide this for inner system use. 1129 * @since 10 1130 */ 1131 function queryPrinterCapability(printerId: string, callback: AsyncCallback<void>): void; 1132 1133 /** 1134 * Query capability for the specific printer. 1135 * @permission ohos.permission.MANAGE_PRINT_JOB 1136 * @param { string } printerId - Indicates id of the printer. 1137 * @returns { Promise<void> } the promise returned by the function. 1138 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1139 * @throws { BusinessError } 202 - not system application 1140 * @syscap SystemCapability.Print.PrintFramework 1141 * @systemapi Hide this for inner system use. 1142 * @since 10 1143 */ 1144 function queryPrinterCapability(printerId: string): Promise<void>; 1145 1146 /** 1147 * Start print job. 1148 * @permission ohos.permission.MANAGE_PRINT_JOB 1149 * @param { PrintJob } jobInfo - Indicates the information of print job. 1150 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 1151 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1152 * @throws { BusinessError } 202 - not system application 1153 * @syscap SystemCapability.Print.PrintFramework 1154 * @systemapi Hide this for inner system use. 1155 * @since 10 1156 */ 1157 function startPrintJob(jobInfo: PrintJob, callback: AsyncCallback<void>): void; 1158 1159 /** 1160 * Start print job. 1161 * @permission ohos.permission.MANAGE_PRINT_JOB 1162 * @param { PrintJob } jobInfo - Indicates the information of print job. 1163 * @returns { Promise<void> } the promise returned by the function. 1164 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1165 * @throws { BusinessError } 202 - not system application 1166 * @syscap SystemCapability.Print.PrintFramework 1167 * @systemapi Hide this for inner system use. 1168 * @since 10 1169 */ 1170 function startPrintJob(jobInfo: PrintJob): Promise<void>; 1171 1172 /** 1173 * Cancel the print job has been sent to printer. 1174 * @permission ohos.permission.MANAGE_PRINT_JOB 1175 * @param { string } jobId - Indicates the specific print job. 1176 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 1177 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1178 * @throws { BusinessError } 202 - not system application 1179 * @syscap SystemCapability.Print.PrintFramework 1180 * @systemapi Hide this for inner system use. 1181 * @since 10 1182 */ 1183 function cancelPrintJob(jobId: string, callback: AsyncCallback<void>): void; 1184 1185 /** 1186 * Cancel the print job has been sent to printer. 1187 * @permission ohos.permission.MANAGE_PRINT_JOB 1188 * @param { string } jobId - Indicates the specific print job. 1189 * @returns { Promise<void> } the promise returned by the function. 1190 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1191 * @throws { BusinessError } 202 - not system application 1192 * @syscap SystemCapability.Print.PrintFramework 1193 * @systemapi Hide this for inner system use. 1194 * @since 10 1195 */ 1196 function cancelPrintJob(jobId: string): Promise<void>; 1197 1198 /** 1199 * Request preview of the print job. 1200 * @permission ohos.permission.MANAGE_PRINT_JOB 1201 * @param { PrintJob } jobInfo - Indicates the information of print job. 1202 * @param { Callback<number> } callback - The callback function for indcating the result of API execution. 1203 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1204 * @throws { BusinessError } 202 - not system application 1205 * @syscap SystemCapability.Print.PrintFramework 1206 * @systemapi Hide this for inner system use. 1207 * @since 10 1208 */ 1209 function requestPrintPreview(jobInfo: PrintJob, callback: Callback<number>): void; 1210 1211 /** 1212 * Request preview of the print job. 1213 * @permission ohos.permission.MANAGE_PRINT_JOB 1214 * @param { PrintJob } jobInfo - Indicates the information of print job. 1215 * @returns { Promise<number> } the promise returned by the function. 1216 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1217 * @throws { BusinessError } 202 - not system application 1218 * @syscap SystemCapability.Print.PrintFramework 1219 * @systemapi Hide this for inner system use. 1220 * @since 10 1221 */ 1222 function requestPrintPreview(jobInfo: PrintJob): Promise<number>; 1223 1224 /** 1225 * Register event callback for the state change of printer. 1226 * @permission ohos.permission.MANAGE_PRINT_JOB 1227 * @param { 'printerStateChange' } type - Indicates state change of printer. 1228 * @param { function } callback - The callback function for state change of printer. 1229 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1230 * @throws { BusinessError } 202 - not system application 1231 * @syscap SystemCapability.Print.PrintFramework 1232 * @systemapi Hide this for inner system use. 1233 * @since 10 1234 */ 1235 function on(type: 'printerStateChange', callback: (state: PrinterState, info: PrinterInfo) => void): void; 1236 1237 /** 1238 * Unregister event callback for the state change of printer. 1239 * @permission ohos.permission.MANAGE_PRINT_JOB 1240 * @param { 'printerStateChange' } type - Indicates state change of printer. 1241 * @param { Callback<boolean> } callback - The callback function for state change of printer. 1242 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1243 * @throws { BusinessError } 202 - not system application 1244 * @syscap SystemCapability.Print.PrintFramework 1245 * @systemapi Hide this for inner system use. 1246 * @since 10 1247 */ 1248 function off(type: 'printerStateChange', callback?: Callback<boolean>): void; 1249 1250 /** 1251 * Register event callback for the state change of print job. 1252 * @permission ohos.permission.MANAGE_PRINT_JOB 1253 * @param { 'jobStateChange' } type - Indicates state change of printer. 1254 * @param { function } callback - The callback function for state change of printer. 1255 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1256 * @throws { BusinessError } 202 - not system application 1257 * @syscap SystemCapability.Print.PrintFramework 1258 * @systemapi Hide this for inner system use. 1259 * @since 10 1260 */ 1261 function on(type: 'jobStateChange', callback: (state: PrintJobState, job: PrintJob) => void): void; 1262 1263 /** 1264 * Unregister event callback for the state change of print job. 1265 * @permission ohos.permission.MANAGE_PRINT_JOB 1266 * @param { 'jobStateChange' } type - Indicates state change of printer. 1267 * @param { Callback<boolean> } callback - The callback function for state change of printer. 1268 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1269 * @throws { BusinessError } 202 - not system application 1270 * @syscap SystemCapability.Print.PrintFramework 1271 * @systemapi Hide this for inner system use. 1272 * @since 10 1273 */ 1274 function off(type: 'jobStateChange', callback?: Callback<boolean>): void; 1275 1276 /** 1277 * Register event callback for the information change of print extension. 1278 * @permission ohos.permission.MANAGE_PRINT_JOB 1279 * @param { 'extInfoChange' } type - Indicates information change of print extension. 1280 * @param { function } callback - The callback function for information change of print extension. 1281 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1282 * @throws { BusinessError } 202 - not system application 1283 * @syscap SystemCapability.Print.PrintFramework 1284 * @systemapi Hide this for inner system use. 1285 * @since 10 1286 */ 1287 function on(type: 'extInfoChange', callback: (extensionId: string, info: string) => void): void; 1288 1289 /** 1290 * Unregister event callback for the information change of print extension. 1291 * @permission ohos.permission.MANAGE_PRINT_JOB 1292 * @param { 'extInfoChange' } type - Indicates state change of printer. 1293 * @param { Callback<boolean> } callback - The callback function for state change of printer. 1294 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1295 * @throws { BusinessError } 202 - not system application 1296 * @syscap SystemCapability.Print.PrintFramework 1297 * @systemapi Hide this for inner system use. 1298 * @since 10 1299 */ 1300 function off(type: 'extInfoChange', callback?: Callback<boolean>): void; 1301 1302 /** 1303 * New printers have been found and notify Print SA. 1304 * @permission ohos.permission.MANAGE_PRINT_JOB 1305 * @param { Array<PrinterInfo> } printers - Indicates new arrived printer lists. 1306 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 1307 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1308 * @throws { BusinessError } 202 - not system application 1309 * @syscap SystemCapability.Print.PrintFramework 1310 * @systemapi Hide this for inner system use. 1311 * @since 10 1312 */ 1313 function addPrinters(printers: Array<PrinterInfo>, callback: AsyncCallback<void>): void; 1314 1315 /** 1316 * New printers have been found and notify Print SA. 1317 * @permission ohos.permission.MANAGE_PRINT_JOB 1318 * @param { Array<PrinterInfo> } printers - Indicates new arrived printer lists. 1319 * @returns { Promise<void> } the promise returned by the function. 1320 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1321 * @throws { BusinessError } 202 - not system application 1322 * @syscap SystemCapability.Print.PrintFramework 1323 * @systemapi Hide this for inner system use. 1324 * @since 10 1325 */ 1326 function addPrinters(printers: Array<PrinterInfo>): Promise<void>; 1327 1328 /** 1329 * Printers have been lost and notify Print SA. 1330 * @permission ohos.permission.MANAGE_PRINT_JOB 1331 * @param { Array<string> } printerIds - Indicates the lost printer lists. 1332 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 1333 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1334 * @throws { BusinessError } 202 - not system application 1335 * @syscap SystemCapability.Print.PrintFramework 1336 * @systemapi Hide this for inner system use. 1337 * @since 10 1338 */ 1339 function removePrinters(printerIds: Array<string>, callback: AsyncCallback<void>): void; 1340 1341 /** 1342 * Printers have been lost and notify Print SA. 1343 * @permission ohos.permission.MANAGE_PRINT_JOB 1344 * @param { Array<string> } printerIds - Indicates the lost printer lists. 1345 * @returns { Promise<void> } the promise returned by the function. 1346 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1347 * @throws { BusinessError } 202 - not system application 1348 * @syscap SystemCapability.Print.PrintFramework 1349 * @systemapi Hide this for inner system use. 1350 * @since 10 1351 */ 1352 function removePrinters(printerIds: Array<string>): Promise<void>; 1353 1354 /** 1355 * Update the information of the specific printers. 1356 * @permission ohos.permission.MANAGE_PRINT_JOB 1357 * @param { Array<PrinterInfo> } printers - Indicates to be updated printer lists. 1358 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 1359 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1360 * @throws { BusinessError } 202 - not system application 1361 * @syscap SystemCapability.Print.PrintFramework 1362 * @systemapi Hide this for inner system use. 1363 * @since 10 1364 */ 1365 function updatePrinters(printers: Array<PrinterInfo>, callback: AsyncCallback<void>): void; 1366 1367 /** 1368 * Update the information of the specific printers. 1369 * @permission ohos.permission.MANAGE_PRINT_JOB 1370 * @param { Array<PrinterInfo> } printers - Indicates to be updated printer lists. 1371 * @returns { Promise<void> } the promise returned by the function. 1372 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1373 * @throws { BusinessError } 202 - not system application 1374 * @syscap SystemCapability.Print.PrintFramework 1375 * @systemapi Hide this for inner system use. 1376 * @since 10 1377 */ 1378 function updatePrinters(printers: Array<PrinterInfo>): Promise<void>; 1379 1380 /** 1381 * Notify Print SA the state of printer has been changed. 1382 * @permission ohos.permission.MANAGE_PRINT_JOB 1383 * @param { string } printerId - Indicates id of the printer. 1384 * @param { PrinterState } state - Indicates state of the printer. 1385 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 1386 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1387 * @throws { BusinessError } 202 - not system application 1388 * @syscap SystemCapability.Print.PrintFramework 1389 * @systemapi Hide this for inner system use. 1390 * @since 10 1391 */ 1392 function updatePrinterState(printerId: string, state: PrinterState, callback: AsyncCallback<void>): void; 1393 1394 /** 1395 * Notify Print SA the state of printer has been changed. 1396 * @permission ohos.permission.MANAGE_PRINT_JOB 1397 * @param { string } printerId - Indicates id of the printer. 1398 * @param { PrinterState } state - Indicates state of the printer. 1399 * @returns { Promise<void> } the promise returned by the function. 1400 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1401 * @throws { BusinessError } 202 - not system application 1402 * @syscap SystemCapability.Print.PrintFramework 1403 * @systemapi Hide this for inner system use. 1404 * @since 10 1405 */ 1406 function updatePrinterState(printerId: string, state: PrinterState): Promise<void>; 1407 1408 /** 1409 * Notify Print SA the state of print job has been changed. 1410 * @permission ohos.permission.MANAGE_PRINT_JOB 1411 * @param { string} jobId - Indicates id of the print job. 1412 * @param { PrintJobState } state - Indicates new state of print job. 1413 * @param { PrintJobSubState } subState - Indicates sub state of print job. 1414 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 1415 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1416 * @throws { BusinessError } 202 - not system application 1417 * @syscap SystemCapability.Print.PrintFramework 1418 * @systemapi Hide this for inner system use. 1419 * @since 10 1420 */ 1421 function updatePrintJobState(jobId: string, state: PrintJobState, subState: PrintJobSubState, callback: AsyncCallback<void>): void; 1422 1423 /** 1424 * Notify Print SA the state of print job has been changed. 1425 * @permission ohos.permission.MANAGE_PRINT_JOB 1426 * @param { string} jobId - Indicates id of the print job. 1427 * @param { PrintJobState } state - Indicates new state of print job. 1428 * @param { PrintJobSubState } subState - Indicates sub state of print job. 1429 * @returns { Promise<void> } the promise returned by the function. 1430 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1431 * @throws { BusinessError } 202 - not system application 1432 * @syscap SystemCapability.Print.PrintFramework 1433 * @systemapi Hide this for inner system use. 1434 * @since 10 1435 */ 1436 function updatePrintJobState(jobId: string, state: PrintJobState, subState: PrintJobSubState): Promise<void>; 1437 1438 /** 1439 * Notify Print SA the state of print extension has been changed. 1440 * @permission ohos.permission.MANAGE_PRINT_JOB 1441 * @param { string } info - Indicates changed information of print extension. 1442 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 1443 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1444 * @throws { BusinessError } 202 - not system application 1445 * @syscap SystemCapability.Print.PrintFramework 1446 * @systemapi Hide this for inner system use. 1447 * @since 10 1448 */ 1449 function updateExtensionInfo(info: string, callback: AsyncCallback<void>): void; 1450 1451 /** 1452 * Notify Print SA the state of print extension has been changed. 1453 * @permission ohos.permission.MANAGE_PRINT_JOB 1454 * @param { string } info - Indicates changed information of print extension. 1455 * @returns { Promise<void> } the promise returned by the function. 1456 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1457 * @throws { BusinessError } 202 - not system application 1458 * @syscap SystemCapability.Print.PrintFramework 1459 * @systemapi Hide this for inner system use. 1460 * @since 10 1461 */ 1462 function updateExtensionInfo(info: string): Promise<void>; 1463 1464 /** 1465 * Get all the printJobs in the queue. 1466 * @permission ohos.permission.MANAGE_PRINT_JOB 1467 * @param { AsyncCallback<void> } callback - The callback function for handling the printJob list found. 1468 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1469 * @throws { BusinessError } 202 - not system application 1470 * @syscap SystemCapability.Print.PrintFramework 1471 * @systemapi Hide this for inner system use. 1472 * @since 10 1473 */ 1474 function queryAllPrintJobs(callback: AsyncCallback<void>): void; 1475 1476 /** 1477 * Get all the printJobs in the queue. 1478 * @permission ohos.permission.MANAGE_PRINT_JOB 1479 * @returns { Promise<void> } the promise returned by the function. 1480 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1481 * @throws { BusinessError } 202 - not system application 1482 * @syscap SystemCapability.Print.PrintFramework 1483 * @systemapi Hide this for inner system use. 1484 * @since 10 1485 */ 1486 function queryAllPrintJobs(): Promise<void>; 1487} 1488 1489export default print;