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 arkts {'1.1':'10','1.2':'20'} 30 * @arkts 1.1&1.2 31 */ 32declare namespace print { 33 34 /** 35 * PrintTask provide event callback. 36 * @interface PrintTask 37 * @syscap SystemCapability.Print.PrintFramework 38 * @since arkts {'1.1':'10','1.2':'20'} 39 * @arkts 1.1&1.2 40 */ 41 interface PrintTask { 42 /** 43 * Register event callback when the current print task is in process. 44 * @permission ohos.permission.PRINT 45 * @param { 'block' } type - Indicates the print task has been blocked. 46 * @param { Callback<void> } callback - The callback function for print task change event 47 * @throws { BusinessError } 201 - the application does not have permission to call this function. 48 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 49 * @syscap SystemCapability.Print.PrintFramework 50 * @since arkts {'1.1':'10','1.2':'20'} 51 * @arkts 1.1&1.2 52 */ 53 on(type: 'block', callback: Callback<void>): void; 54 55 /** 56 * Register event callback when the current print task is in process. 57 * @permission ohos.permission.PRINT 58 * @param { 'succeed' } type - Indicates the print task succeed. 59 * @param { Callback<void> } callback - The callback function for print task change event 60 * @throws { BusinessError } 201 - the application does not have permission to call this function. 61 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 62 * @syscap SystemCapability.Print.PrintFramework 63 * @since arkts {'1.1':'10','1.2':'20'} 64 * @arkts 1.1&1.2 65 */ 66 on(type: 'succeed', callback: Callback<void>): void; 67 68 /** 69 * Register event callback when the current print task is in process. 70 * @permission ohos.permission.PRINT 71 * @param { 'fail' } type - Indicates the print task has completed with failure. 72 * @param { Callback<void> } callback - The callback function for print task change event 73 * @throws { BusinessError } 201 - the application does not have permission to call this function. 74 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 75 * @syscap SystemCapability.Print.PrintFramework 76 * @since arkts {'1.1':'10','1.2':'20'} 77 * @arkts 1.1&1.2 78 */ 79 on(type: 'fail', callback: Callback<void>): void; 80 81 /** 82 * Register event callback when the current print task is in process. 83 * @permission ohos.permission.PRINT 84 * @param { 'cancel' } type - Indicates the print task has been cancelled. 85 * @param { Callback<void> } callback - The callback function for print task change event 86 * @throws { BusinessError } 201 - the application does not have permission to call this function. 87 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 88 * @syscap SystemCapability.Print.PrintFramework 89 * @since arkts {'1.1':'10','1.2':'20'} 90 * @arkts 1.1&1.2 91 */ 92 on(type: 'cancel', callback: Callback<void>): void; 93 94 /** 95 * Unregister event callback when the current print task is in process. 96 * @permission ohos.permission.PRINT 97 * @param { 'block' } type - Indicates the print task has been blocked. 98 * @param { Callback<void> } callback - The callback function for print task change event 99 * @throws { BusinessError } 201 - the application does not have permission to call this function. 100 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 101 * @syscap SystemCapability.Print.PrintFramework 102 * @since arkts {'1.1':'10','1.2':'20'} 103 * @arkts 1.1&1.2 104 */ 105 off(type: 'block', callback?: Callback<void>): void; 106 107 /** 108 * Unregister event callback when the current print task is in process. 109 * @permission ohos.permission.PRINT 110 * @param { 'succeed' } type - Indicates the print task succeed. 111 * @param { Callback<void> } callback - The callback function for print task change event 112 * @throws { BusinessError } 201 - the application does not have permission to call this function. 113 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 114 * @syscap SystemCapability.Print.PrintFramework 115 * @since arkts {'1.1':'10','1.2':'20'} 116 * @arkts 1.1&1.2 117 */ 118 off(type: 'succeed', callback?: Callback<void>): void; 119 120 /** 121 * Unregister event callback when the current print task is in process. 122 * @permission ohos.permission.PRINT 123 * @param { 'fail' } type - Indicates the print task has completed with failure. 124 * @param { Callback<void> } callback - The callback function for print task change event 125 * @throws { BusinessError } 201 - the application does not have permission to call this function. 126 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 127 * @syscap SystemCapability.Print.PrintFramework 128 * @since arkts {'1.1':'10','1.2':'20'} 129 * @arkts 1.1&1.2 130 */ 131 off(type: 'fail', callback?: Callback<void>): void; 132 133 /** 134 * Unregister event callback when the current print task is in process. 135 * @permission ohos.permission.PRINT 136 * @param { 'cancel' } type - Indicates the print task has been cancelled. 137 * @param { Callback<void> } callback - The callback function for print task change event 138 * @throws { BusinessError } 201 - the application does not have permission to call this function. 139 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 140 * @syscap SystemCapability.Print.PrintFramework 141 * @since arkts {'1.1':'10','1.2':'20'} 142 * @arkts 1.1&1.2 143 */ 144 off(type: 'cancel', callback?: Callback<void>): void; 145 } 146 147 /** 148 * Third-party application implement this interface to render files to be printed. 149 * @interface PrintDocumentAdapter 150 * @syscap SystemCapability.Print.PrintFramework 151 * @since arkts {'1.1':'11','1.2':'20'} 152 * @arkts 1.1&1.2 153 */ 154 interface PrintDocumentAdapter { 155 156 /** 157 * Implement this function to update the print file. 158 * @permission ohos.permission.PRINT 159 * @param { string } jobId - Indicates print job id. 160 * @param { PrintAttributes } oldAttrs - Indicates old print attributes. 161 * @param { PrintAttributes } newAttrs - Indicates new print attributes. 162 * @param { int } fd - Indicates print file fd. 163 * @param { function } writeResultCallback - Indicates this function should execute after the file is updated. 164 * @throws { BusinessError } 201 - the application does not have permission to call this function. 165 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 166 * @syscap SystemCapability.Print.PrintFramework 167 * @since arkts {'1.1':'11','1.2':'20'} 168 * @arkts 1.1&1.2 169 */ 170 onStartLayoutWrite(jobId: string, oldAttrs: PrintAttributes, newAttrs: PrintAttributes, fd: int, 171 writeResultCallback: (jobId: string, writeResult: PrintFileCreationState) => void): void; 172 173 /** 174 * Implement this function to listen job status change. 175 * @permission ohos.permission.PRINT 176 * @param { string } jobId - Indicates print job id. 177 * @param { PrintDocumentAdapterState } state - Indicates job changes to this state. 178 * @throws { BusinessError } 201 - the application does not have permission to call this function. 179 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 180 * @syscap SystemCapability.Print.PrintFramework 181 * @since arkts {'1.1':'11','1.2':'20'} 182 * @arkts 1.1&1.2 183 */ 184 onJobStateChanged(jobId: string, state: PrintDocumentAdapterState): void; 185 } 186 187 /** 188 * Start new print task for App. 189 * @permission ohos.permission.PRINT 190 * @param { Array<string> } files - Indicates the filepath list to be printed. Only pdf and picture filetype are supported. 191 * @param { AsyncCallback<PrintTask> } callback - The callback function for print task. 192 * @throws { BusinessError } 201 - the application does not have permission to call this function. 193 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 194 * @syscap SystemCapability.Print.PrintFramework 195 * @since arkts {'1.1':'10','1.2':'20'} 196 * @arkts 1.1&1.2 197 */ 198 function print(files: Array<string>, callback: AsyncCallback<PrintTask>): void; 199 200 /** 201 * Start new print task for App. 202 * @permission ohos.permission.PRINT 203 * @param { Array<string> } files - Indicates the filepath list to be printed. Only pdf and picture filetype are supported. 204 * @returns { Promise<PrintTask> } the promise returned by the function. 205 * @throws { BusinessError } 201 - the application does not have permission to call this function. 206 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 207 * @syscap SystemCapability.Print.PrintFramework 208 * @since arkts {'1.1':'10','1.2':'20'} 209 * @arkts 1.1&1.2 210 */ 211 function print(files: Array<string>): Promise<PrintTask>; 212 213 /** 214 * Start new print task for App. 215 * @permission ohos.permission.PRINT 216 * @param { Array<string> } files - Indicates the filepath list to be printed. Only pdf and picture filetype are supported. 217 * @param { Context } context - The ability context that initiates the call print request. 218 * @param { AsyncCallback<PrintTask> } callback - The callback function for print task. 219 * @throws { BusinessError } 201 - the application does not have permission to call this function. 220 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 221 * @syscap SystemCapability.Print.PrintFramework 222 * @since arkts {'1.1':'11','1.2':'20'} 223 * @arkts 1.1&1.2 224 */ 225 function print(files: Array<string>, context: Context, callback: AsyncCallback<PrintTask>): void; 226 227 /** 228 * Start new print task for App. 229 * @permission ohos.permission.PRINT 230 * @param { Array<string> } files - Indicates the filepath list to be printed. Only pdf and picture filetype are supported. 231 * @param { Context } context - The ability context that initiates the call print request. 232 * @returns { Promise<PrintTask> } the promise returned by the function. 233 * @throws { BusinessError } 201 - the application does not have permission to call this function. 234 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 235 * @syscap SystemCapability.Print.PrintFramework 236 * @since arkts {'1.1':'11','1.2':'20'} 237 * @arkts 1.1&1.2 238 */ 239 function print(files: Array<string>, context: Context): Promise<PrintTask>; 240 241 /** 242 * Start new print task for App And the App need update print file. 243 * @permission ohos.permission.PRINT 244 * @param { string } jobName - Indicates print file Name. 245 * @param { PrintDocumentAdapter } printAdapter - Indicates functions implemented by the cpp. 246 * @param { PrintAttributes } printAttributes - Indicates print attributes. 247 * @param { Context } context - The ability context that initiates the call print request. 248 * @returns { Promise<PrintTask> } the promise returned by the function. 249 * @throws { BusinessError } 201 - the application does not have permission to call this function. 250 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 251 * @syscap SystemCapability.Print.PrintFramework 252 * @since arkts {'1.1':'11','1.2':'20'} 253 * @arkts 1.1&1.2 254 */ 255 function print(jobName: string, printAdapter: PrintDocumentAdapter, printAttributes: PrintAttributes, 256 context: Context): Promise<PrintTask>; 257 258 /** 259 * defines print attributes. 260 * @typedef PrintAttributes 261 * @syscap SystemCapability.Print.PrintFramework 262 * @since arkts {'1.1':'11','1.2':'20'} 263 * @arkts 1.1&1.2 264 */ 265 interface PrintAttributes { 266 /** 267 * Copies of document list. 268 * @type { ?int } 269 * @syscap SystemCapability.Print.PrintFramework 270 * @since arkts {'1.1':'11','1.2':'20'} 271 * @arkts 1.1&1.2 272 */ 273 copyNumber?: int; 274 275 /** 276 * Range size to be printed. 277 * @type { ?PrintPageRange } 278 * @syscap SystemCapability.Print.PrintFramework 279 * @since arkts {'1.1':'11','1.2':'20'} 280 * @arkts 1.1&1.2 281 */ 282 pageRange?: PrintPageRange; 283 284 /** 285 * Page size. 286 * @type { ?(PrintPageSize | PrintPageType) } 287 * @syscap SystemCapability.Print.PrintFramework 288 * @since arkts {'1.1':'11','1.2':'20'} 289 * @arkts 1.1&1.2 290 */ 291 pageSize?: PrintPageSize | PrintPageType; 292 293 /** 294 * Print direction. 295 * @type { ?PrintDirectionMode } 296 * @syscap SystemCapability.Print.PrintFramework 297 * @since arkts {'1.1':'11','1.2':'20'} 298 * @arkts 1.1&1.2 299 */ 300 directionMode?: PrintDirectionMode; 301 302 /** 303 * Color mode. 304 * @type { ?PrintColorMode } 305 * @syscap SystemCapability.Print.PrintFramework 306 * @since arkts {'1.1':'11','1.2':'20'} 307 * @arkts 1.1&1.2 308 */ 309 colorMode?: PrintColorMode; 310 311 /** 312 * Duplex mode. 313 * @type { ?PrintDuplexMode } 314 * @syscap SystemCapability.Print.PrintFramework 315 * @since arkts {'1.1':'11','1.2':'20'} 316 * @arkts 1.1&1.2 317 */ 318 duplexMode?: PrintDuplexMode; 319 } 320 321 /** 322 * defines print page range. 323 * @typedef PrintPageRange 324 * @syscap SystemCapability.Print.PrintFramework 325 * @since arkts {'1.1':'11','1.2':'20'} 326 * @arkts 1.1&1.2 327 */ 328 interface PrintPageRange { 329 /** 330 * Start page of sequence. 331 * @type { ?int } 332 * @syscap SystemCapability.Print.PrintFramework 333 * @since arkts {'1.1':'11','1.2':'20'} 334 * @arkts 1.1&1.2 335 */ 336 startPage?: int; 337 338 /** 339 * End page of sequence. 340 * @type { ?int } 341 * @syscap SystemCapability.Print.PrintFramework 342 * @since arkts {'1.1':'11','1.2':'20'} 343 * @arkts 1.1&1.2 344 */ 345 endPage?: int; 346 347 /** 348 * Discrete page of sequence. 349 * @type { ?Array<int> } 350 * @syscap SystemCapability.Print.PrintFramework 351 * @since arkts {'1.1':'11','1.2':'20'} 352 * @arkts 1.1&1.2 353 */ 354 pages?: Array<int>; 355 } 356 357 /** 358 * defines print margin. 359 * @typedef PrintMargin 360 * @syscap SystemCapability.Print.PrintFramework 361 * @systemapi Hide this for inner system use. 362 * @since arkts {'1.1':'10','1.2':'20'} 363 * @arkts 1.1&1.2 364 */ 365 interface PrintMargin { 366 /** 367 * Top margin. 368 * @type { ?int } 369 * @syscap SystemCapability.Print.PrintFramework 370 * @systemapi 371 * @since arkts {'1.1':'10','1.2':'20'} 372 * @arkts 1.1&1.2 373 */ 374 top?: int; 375 376 /** 377 * Bottom margin. 378 * @type { ?int } 379 * @syscap SystemCapability.Print.PrintFramework 380 * @systemapi 381 * @since arkts {'1.1':'10','1.2':'20'} 382 * @arkts 1.1&1.2 383 */ 384 bottom?: int; 385 386 /** 387 * Left margin. 388 * @type { ?int } 389 * @syscap SystemCapability.Print.PrintFramework 390 * @systemapi 391 * @since arkts {'1.1':'10','1.2':'20'} 392 * @arkts 1.1&1.2 393 */ 394 left?: int; 395 396 /** 397 * Right margin. 398 * @type { ?int } 399 * @syscap SystemCapability.Print.PrintFramework 400 * @systemapi 401 * @since arkts {'1.1':'10','1.2':'20'} 402 * @arkts 1.1&1.2 403 */ 404 right?: int; 405 } 406 407 /** 408 * defines print range. 409 * @typedef PrinterRange 410 * @syscap SystemCapability.Print.PrintFramework 411 * @systemapi Hide this for inner system use. 412 * @since arkts {'1.1':'10','1.2':'20'} 413 * @arkts 1.1&1.2 414 */ 415 interface PrinterRange { 416 /** 417 * Start page of sequence. 418 * @type { ?int } 419 * @syscap SystemCapability.Print.PrintFramework 420 * @systemapi 421 * @since arkts {'1.1':'10','1.2':'20'} 422 * @arkts 1.1&1.2 423 */ 424 startPage?: int; 425 426 /** 427 * End page of sequence. 428 * @type { ?int } 429 * @syscap SystemCapability.Print.PrintFramework 430 * @systemapi 431 * @since arkts {'1.1':'10','1.2':'20'} 432 * @arkts 1.1&1.2 433 */ 434 endPage?: int; 435 436 /** 437 * Discrete page of sequence. 438 * @type { ?Array<int> } 439 * @syscap SystemCapability.Print.PrintFramework 440 * @systemapi 441 * @since arkts {'1.1':'10','1.2':'20'} 442 * @arkts 1.1&1.2 443 */ 444 pages?: Array<int>; 445 } 446 447 /** 448 * defines print preview attribute. 449 * @typedef PreviewAttribute 450 * @syscap SystemCapability.Print.PrintFramework 451 * @systemapi Hide this for inner system use. 452 * @since arkts {'1.1':'10','1.2':'20'} 453 * @arkts 1.1&1.2 454 */ 455 interface PreviewAttribute { 456 /** 457 * Preview page range. 458 * @type { PrinterRange } 459 * @syscap SystemCapability.Print.PrintFramework 460 * @systemapi 461 * @since arkts {'1.1':'10','1.2':'20'} 462 * @arkts 1.1&1.2 463 */ 464 previewRange: PrinterRange; 465 466 /** 467 * Preview file result. 468 * @type { ?int } 469 * @syscap SystemCapability.Print.PrintFramework 470 * @systemapi 471 * @since arkts {'1.1':'10','1.2':'20'} 472 * @arkts 1.1&1.2 473 */ 474 result?: int; 475 } 476 477 /** 478 * defines print resolution. 479 * @typedef PrintResolution 480 * @syscap SystemCapability.Print.PrintFramework 481 * @systemapi Hide this for inner system use. 482 * @since arkts {'1.1':'10','1.2':'20'} 483 * @arkts 1.1&1.2 484 */ 485 interface PrintResolution { 486 /** 487 * Resolution id. 488 * @type { string } 489 * @syscap SystemCapability.Print.PrintFramework 490 * @systemapi 491 * @since arkts {'1.1':'10','1.2':'20'} 492 * @arkts 1.1&1.2 493 */ 494 id: string; 495 496 /** 497 * Horizontal DPI. 498 * @type { int } 499 * @syscap SystemCapability.Print.PrintFramework 500 * @systemapi 501 * @since arkts {'1.1':'10','1.2':'20'} 502 * @arkts 1.1&1.2 503 */ 504 horizontalDpi: int; 505 506 /** 507 * Vertical DPI. 508 * @type { int } 509 * @syscap SystemCapability.Print.PrintFramework 510 * @systemapi 511 * @since arkts {'1.1':'10','1.2':'20'} 512 * @arkts 1.1&1.2 513 */ 514 verticalDpi: int; 515 } 516 517 /** 518 * defines print page size. 519 * @typedef PrintPageSize 520 * @syscap SystemCapability.Print.PrintFramework 521 * @since arkts {'1.1':'11','1.2':'20'} 522 * @arkts 1.1&1.2 523 */ 524 interface PrintPageSize { 525 /** 526 * Page size id. 527 * @type { string } 528 * @syscap SystemCapability.Print.PrintFramework 529 * @since arkts {'1.1':'11','1.2':'20'} 530 * @arkts 1.1&1.2 531 */ 532 id: string; 533 534 /** 535 * Page size name. 536 * @type { string } 537 * @syscap SystemCapability.Print.PrintFramework 538 * @since arkts {'1.1':'11','1.2':'20'} 539 * @arkts 1.1&1.2 540 */ 541 name: string; 542 543 /** 544 * Unit: millimeter width. 545 * @type { int } 546 * @syscap SystemCapability.Print.PrintFramework 547 * @since arkts {'1.1':'11','1.2':'20'} 548 * @arkts 1.1&1.2 549 */ 550 width: int; 551 552 /** 553 * Unit: millimeter height. 554 * @type { int } 555 * @syscap SystemCapability.Print.PrintFramework 556 * @since arkts {'1.1':'11','1.2':'20'} 557 * @arkts 1.1&1.2 558 */ 559 height: int; 560 } 561 562 /** 563 * defines print capability. 564 * @typedef PrinterCapability 565 * @syscap SystemCapability.Print.PrintFramework 566 * @systemapi Hide this for inner system use. 567 * @since arkts {'1.1':'10','1.2':'20'} 568 * @arkts 1.1&1.2 569 */ 570 interface PrinterCapability { 571 /** 572 * Color mode. 573 * @type { int } 574 * @syscap SystemCapability.Print.PrintFramework 575 * @systemapi 576 * @since arkts {'1.1':'10','1.2':'20'} 577 * @arkts 1.1&1.2 578 */ 579 colorMode: int; 580 581 /** 582 * Duplex mode. 583 * @type { int } 584 * @syscap SystemCapability.Print.PrintFramework 585 * @systemapi 586 * @since arkts {'1.1':'10','1.2':'20'} 587 * @arkts 1.1&1.2 588 */ 589 duplexMode: int; 590 591 /** 592 * The page size list supported by the printer. 593 * @type { Array<PrintPageSize> } 594 * @syscap SystemCapability.Print.PrintFramework 595 * @systemapi 596 * @since arkts {'1.1':'10','1.2':'20'} 597 * @arkts 1.1&1.2 598 */ 599 pageSize: Array<PrintPageSize>; 600 601 /** 602 * The resolution list supported by the printer. 603 * @type { ?Array<PrintResolution> } 604 * @syscap SystemCapability.Print.PrintFramework 605 * @systemapi 606 * @since arkts {'1.1':'10','1.2':'20'} 607 * @arkts 1.1&1.2 608 */ 609 resolution?: Array<PrintResolution>; 610 611 /** 612 * Min margin of printer. 613 * @type { ?PrintMargin } 614 * @syscap SystemCapability.Print.PrintFramework 615 * @systemapi 616 * @since arkts {'1.1':'10','1.2':'20'} 617 * @arkts 1.1&1.2 618 */ 619 minMargin?: PrintMargin; 620 621 /** 622 * JSON object string. 623 * @type { ?Object } 624 * @syscap SystemCapability.Print.PrintFramework 625 * @systemapi 626 * @since arkts {'1.1':'11','1.2':'20'} 627 * @arkts 1.1&1.2 628 */ 629 options?: Object; 630 } 631 632 /** 633 * defines print info. 634 * @typedef PrinterInfo 635 * @syscap SystemCapability.Print.PrintFramework 636 * @systemapi Hide this for inner system use. 637 * @since arkts {'1.1':'10','1.2':'20'} 638 * @arkts 1.1&1.2 639 */ 640 interface PrinterInfo { 641 /** 642 * Printer id. 643 * @type { string } 644 * @syscap SystemCapability.Print.PrintFramework 645 * @systemapi 646 * @since arkts {'1.1':'10','1.2':'20'} 647 * @arkts 1.1&1.2 648 */ 649 printerId: string; 650 651 /** 652 * Printer name. 653 * @type { string } 654 * @syscap SystemCapability.Print.PrintFramework 655 * @systemapi 656 * @since arkts {'1.1':'10','1.2':'20'} 657 * @arkts 1.1&1.2 658 */ 659 printerName: string; 660 661 /** 662 * Current printer state. 663 * @type { PrinterState } 664 * @syscap SystemCapability.Print.PrintFramework 665 * @systemapi 666 * @since arkts {'1.1':'10','1.2':'20'} 667 * @arkts 1.1&1.2 668 */ 669 printerState: PrinterState; 670 671 /** 672 * Resource id of printer icon. 673 * @type { ?int } 674 * @syscap SystemCapability.Print.PrintFramework 675 * @systemapi 676 * @since arkts {'1.1':'10','1.2':'20'} 677 * @arkts 1.1&1.2 678 */ 679 printerIcon?: int; 680 681 /** 682 * Printer description. 683 * @type { ?string } 684 * @syscap SystemCapability.Print.PrintFramework 685 * @systemapi 686 * @since arkts {'1.1':'10','1.2':'20'} 687 * @arkts 1.1&1.2 688 */ 689 description?: string; 690 691 /** 692 * Printer capability. 693 * @type { ?PrinterCapability } 694 * @syscap SystemCapability.Print.PrintFramework 695 * @systemapi 696 * @since arkts {'1.1':'10','1.2':'20'} 697 * @arkts 1.1&1.2 698 */ 699 capability?: PrinterCapability; 700 701 /** 702 * JSON object string. 703 * @type { ?Object } 704 * @syscap SystemCapability.Print.PrintFramework 705 * @systemapi 706 * @since arkts {'1.1':'10','1.2':'20'} 707 * @arkts 1.1&1.2 708 */ 709 options?: Object; 710 } 711 712 /** 713 * defines print job. 714 * @typedef PrintJob 715 * @syscap SystemCapability.Print.PrintFramework 716 * @systemapi Hide this for inner system use. 717 * @since arkts {'1.1':'10','1.2':'20'} 718 * @arkts 1.1&1.2 719 */ 720 interface PrintJob { 721 /** 722 * Document fd list to be printed. 723 * @type { Array<int> } 724 * @syscap SystemCapability.Print.PrintFramework 725 * @systemapi 726 * @since arkts {'1.1':'10','1.2':'20'} 727 * @arkts 1.1&1.2 728 */ 729 fdList: Array<int>; 730 731 /** 732 * Job id. 733 * @type { string } 734 * @syscap SystemCapability.Print.PrintFramework 735 * @systemapi 736 * @since arkts {'1.1':'10','1.2':'20'} 737 * @arkts 1.1&1.2 738 */ 739 jobId: string; 740 741 /** 742 * Printer id to take charge of printing. 743 * @type { string } 744 * @syscap SystemCapability.Print.PrintFramework 745 * @systemapi 746 * @since arkts {'1.1':'10','1.2':'20'} 747 * @arkts 1.1&1.2 748 */ 749 printerId: string; 750 751 /** 752 * Current print job state. 753 * @type { PrintJobState } 754 * @syscap SystemCapability.Print.PrintFramework 755 * @systemapi 756 * @since arkts {'1.1':'10','1.2':'20'} 757 * @arkts 1.1&1.2 758 */ 759 jobState: PrintJobState; 760 761 /** 762 * Current print job sub state. 763 * @type { PrintJobSubState } 764 * @syscap SystemCapability.Print.PrintFramework 765 * @systemapi 766 * @since arkts {'1.1':'11','1.2':'20'} 767 * @arkts 1.1&1.2 768 */ 769 jobSubstate: PrintJobSubState; 770 771 /** 772 * Copies of document list. 773 * @type { int } 774 * @syscap SystemCapability.Print.PrintFramework 775 * @systemapi 776 * @since arkts {'1.1':'10','1.2':'20'} 777 * @arkts 1.1&1.2 778 */ 779 copyNumber: int; 780 781 /** 782 * Range size to be printed. 783 * @type { PrinterRange } 784 * @syscap SystemCapability.Print.PrintFramework 785 * @systemapi 786 * @since arkts {'1.1':'10','1.2':'20'} 787 * @arkts 1.1&1.2 788 */ 789 pageRange: PrinterRange; 790 791 /** 792 * Sequential print. 793 * @type { boolean } 794 * @syscap SystemCapability.Print.PrintFramework 795 * @systemapi 796 * @since arkts {'1.1':'10','1.2':'20'} 797 * @arkts 1.1&1.2 798 */ 799 isSequential: boolean; 800 801 /** 802 * The selected page size. 803 * @type { PrintPageSize } 804 * @syscap SystemCapability.Print.PrintFramework 805 * @systemapi 806 * @since arkts {'1.1':'10','1.2':'20'} 807 * @arkts 1.1&1.2 808 */ 809 pageSize: PrintPageSize; 810 811 /** 812 * Vertical printing. 813 * @type { boolean } 814 * @syscap SystemCapability.Print.PrintFramework 815 * @systemapi 816 * @since arkts {'1.1':'10','1.2':'20'} 817 * @arkts 1.1&1.2 818 */ 819 isLandscape: boolean; 820 821 /** 822 * Color mode. 823 * @type { int } 824 * @syscap SystemCapability.Print.PrintFramework 825 * @systemapi 826 * @since arkts {'1.1':'10','1.2':'20'} 827 * @arkts 1.1&1.2 828 */ 829 colorMode: int; 830 831 /** 832 * Duplex mode. 833 * @type { int } 834 * @syscap SystemCapability.Print.PrintFramework 835 * @systemapi 836 * @since arkts {'1.1':'10','1.2':'20'} 837 * @arkts 1.1&1.2 838 */ 839 duplexMode: int; 840 841 /** 842 * Current margin setting. 843 * @type { ?PrintMargin } 844 * @syscap SystemCapability.Print.PrintFramework 845 * @systemapi 846 * @since arkts {'1.1':'10','1.2':'20'} 847 * @arkts 1.1&1.2 848 */ 849 margin?: PrintMargin; 850 851 /** 852 * Preview setting. 853 * @type { ?PreviewAttribute } 854 * @syscap SystemCapability.Print.PrintFramework 855 * @systemapi 856 * @since arkts {'1.1':'10','1.2':'20'} 857 * @arkts 1.1&1.2 858 */ 859 preview?: PreviewAttribute; 860 861 /** 862 * JSON object string. 863 * @type { ?Object } 864 * @syscap SystemCapability.Print.PrintFramework 865 * @systemapi 866 * @since arkts {'1.1':'10','1.2':'20'} 867 * @arkts 1.1&1.2 868 */ 869 options?: Object; 870 } 871 872 /** 873 * Enumeration of Print Direction Mode. 874 * @enum { int } PrintDirectionMode 875 * @syscap SystemCapability.Print.PrintFramework 876 * @since arkts {'1.1':'11','1.2':'20'} 877 * @arkts 1.1&1.2 878 */ 879 enum PrintDirectionMode { 880 /** 881 * Automatically select direction. 882 * @syscap SystemCapability.Print.PrintFramework 883 * @since arkts {'1.1':'11','1.2':'20'} 884 * @arkts 1.1&1.2 885 */ 886 DIRECTION_MODE_AUTO = 0, 887 888 /** 889 * Print portrait. 890 * @syscap SystemCapability.Print.PrintFramework 891 * @since arkts {'1.1':'11','1.2':'20'} 892 * @arkts 1.1&1.2 893 */ 894 DIRECTION_MODE_PORTRAIT = 1, 895 896 /** 897 * Print landscape. 898 * @syscap SystemCapability.Print.PrintFramework 899 * @since arkts {'1.1':'11','1.2':'20'} 900 * @arkts 1.1&1.2 901 */ 902 DIRECTION_MODE_LANDSCAPE = 2, 903 } 904 905 /** 906 * Enumeration of Print Color Mode. 907 * @enum { int } PrintColorMode 908 * @syscap SystemCapability.Print.PrintFramework 909 * @since arkts {'1.1':'11','1.2':'20'} 910 * @arkts 1.1&1.2 911 */ 912 enum PrintColorMode { 913 /** 914 * Print monochrome. 915 * @syscap SystemCapability.Print.PrintFramework 916 * @since arkts {'1.1':'11','1.2':'20'} 917 * @arkts 1.1&1.2 918 */ 919 COLOR_MODE_MONOCHROME = 0, 920 921 /** 922 * Color printing. 923 * @syscap SystemCapability.Print.PrintFramework 924 * @since arkts {'1.1':'11','1.2':'20'} 925 * @arkts 1.1&1.2 926 */ 927 COLOR_MODE_COLOR = 1, 928 } 929 930 /** 931 * Enumeration of Print Duplex Mode. 932 * @enum { int } PrintDuplexMode 933 * @syscap SystemCapability.Print.PrintFramework 934 * @since arkts {'1.1':'11','1.2':'20'} 935 * @arkts 1.1&1.2 936 */ 937 enum PrintDuplexMode { 938 /** 939 * Single side printing. 940 * @syscap SystemCapability.Print.PrintFramework 941 * @since arkts {'1.1':'11','1.2':'20'} 942 * @arkts 1.1&1.2 943 */ 944 DUPLEX_MODE_NONE = 0, 945 946 /** 947 * Long-edge flip-up duplex printing. 948 * @syscap SystemCapability.Print.PrintFramework 949 * @since arkts {'1.1':'11','1.2':'20'} 950 * @arkts 1.1&1.2 951 */ 952 DUPLEX_MODE_LONG_EDGE = 1, 953 954 /** 955 * Short-edge flip-up duplex printing. 956 * @syscap SystemCapability.Print.PrintFramework 957 * @since arkts {'1.1':'11','1.2':'20'} 958 * @arkts 1.1&1.2 959 */ 960 DUPLEX_MODE_SHORT_EDGE = 2, 961 } 962 963 /** 964 * Enumeration of Print Page Type. 965 * @enum { int } PrintPageType 966 * @syscap SystemCapability.Print.PrintFramework 967 * @since arkts {'1.1':'11','1.2':'20'} 968 * @arkts 1.1&1.2 969 */ 970 enum PrintPageType { 971 /** 972 * A3 page. 973 * @syscap SystemCapability.Print.PrintFramework 974 * @since arkts {'1.1':'11','1.2':'20'} 975 * @arkts 1.1&1.2 976 */ 977 PAGE_ISO_A3 = 0, 978 979 /** 980 * A4 page. 981 * @syscap SystemCapability.Print.PrintFramework 982 * @since arkts {'1.1':'11','1.2':'20'} 983 * @arkts 1.1&1.2 984 */ 985 PAGE_ISO_A4 = 1, 986 987 /** 988 * A5 page. 989 * @syscap SystemCapability.Print.PrintFramework 990 * @since arkts {'1.1':'11','1.2':'20'} 991 * @arkts 1.1&1.2 992 */ 993 PAGE_ISO_A5 = 2, 994 995 /** 996 * B5 page. 997 * @syscap SystemCapability.Print.PrintFramework 998 * @since arkts {'1.1':'11','1.2':'20'} 999 * @arkts 1.1&1.2 1000 */ 1001 PAGE_JIS_B5 = 3, 1002 1003 /** 1004 * C5 page. 1005 * @syscap SystemCapability.Print.PrintFramework 1006 * @since arkts {'1.1':'11','1.2':'20'} 1007 * @arkts 1.1&1.2 1008 */ 1009 PAGE_ISO_C5 = 4, 1010 1011 /** 1012 * DL Envelope. 1013 * @syscap SystemCapability.Print.PrintFramework 1014 * @since arkts {'1.1':'11','1.2':'20'} 1015 * @arkts 1.1&1.2 1016 */ 1017 PAGE_ISO_DL = 5, 1018 1019 /** 1020 * Letter. 1021 * @syscap SystemCapability.Print.PrintFramework 1022 * @since arkts {'1.1':'11','1.2':'20'} 1023 * @arkts 1.1&1.2 1024 */ 1025 PAGE_LETTER = 6, 1026 1027 /** 1028 * Legal. 1029 * @syscap SystemCapability.Print.PrintFramework 1030 * @since arkts {'1.1':'11','1.2':'20'} 1031 * @arkts 1.1&1.2 1032 */ 1033 PAGE_LEGAL = 7, 1034 1035 /** 1036 * Photo 4x6. 1037 * @syscap SystemCapability.Print.PrintFramework 1038 * @since arkts {'1.1':'11','1.2':'20'} 1039 * @arkts 1.1&1.2 1040 */ 1041 PAGE_PHOTO_4X6 = 8, 1042 1043 /** 1044 * Photo 5x7. 1045 * @syscap SystemCapability.Print.PrintFramework 1046 * @since arkts {'1.1':'11','1.2':'20'} 1047 * @arkts 1.1&1.2 1048 */ 1049 PAGE_PHOTO_5X7 = 9, 1050 1051 /** 1052 * Envelope INT DL. 1053 * @syscap SystemCapability.Print.PrintFramework 1054 * @since arkts {'1.1':'11','1.2':'20'} 1055 * @arkts 1.1&1.2 1056 */ 1057 PAGE_INT_DL_ENVELOPE = 10, 1058 1059 /** 1060 * Tabloid B. 1061 * @syscap SystemCapability.Print.PrintFramework 1062 * @since arkts {'1.1':'11','1.2':'20'} 1063 * @arkts 1.1&1.2 1064 */ 1065 PAGE_B_TABLOID = 11, 1066 } 1067 1068 /** 1069 * Enumeration of Print Document Adapter State. 1070 * @enum { int } PrintDocumentAdapterState 1071 * @syscap SystemCapability.Print.PrintFramework 1072 * @since arkts {'1.1':'11','1.2':'20'} 1073 * @arkts 1.1&1.2 1074 */ 1075 enum PrintDocumentAdapterState { 1076 /** 1077 * Preview failed. 1078 * @syscap SystemCapability.Print.PrintFramework 1079 * @since arkts {'1.1':'11','1.2':'20'} 1080 * @arkts 1.1&1.2 1081 */ 1082 PREVIEW_DESTROY = 0, 1083 1084 /** 1085 * Print state is succeed. 1086 * @syscap SystemCapability.Print.PrintFramework 1087 * @since arkts {'1.1':'11','1.2':'20'} 1088 * @arkts 1.1&1.2 1089 */ 1090 PRINT_TASK_SUCCEED = 1, 1091 1092 /** 1093 * Print state is fail. 1094 * @syscap SystemCapability.Print.PrintFramework 1095 * @since arkts {'1.1':'11','1.2':'20'} 1096 * @arkts 1.1&1.2 1097 */ 1098 PRINT_TASK_FAIL = 2, 1099 1100 /** 1101 * Print state is cancel. 1102 * @syscap SystemCapability.Print.PrintFramework 1103 * @since arkts {'1.1':'11','1.2':'20'} 1104 * @arkts 1.1&1.2 1105 */ 1106 PRINT_TASK_CANCEL = 3, 1107 1108 /** 1109 * Print state is block. 1110 * @syscap SystemCapability.Print.PrintFramework 1111 * @since arkts {'1.1':'11','1.2':'20'} 1112 * @arkts 1.1&1.2 1113 */ 1114 PRINT_TASK_BLOCK = 4, 1115 } 1116 1117 /** 1118 * Enumeration of Print File Creation State. 1119 * @enum { int } PrintFileCreationState 1120 * @syscap SystemCapability.Print.PrintFramework 1121 * @since arkts {'1.1':'11','1.2':'20'} 1122 * @arkts 1.1&1.2 1123 */ 1124 enum PrintFileCreationState { 1125 /** 1126 * Print file created success. 1127 * @syscap SystemCapability.Print.PrintFramework 1128 * @since arkts {'1.1':'11','1.2':'20'} 1129 * @arkts 1.1&1.2 1130 */ 1131 PRINT_FILE_CREATED = 0, 1132 1133 /** 1134 * Print file created fail. 1135 * @syscap SystemCapability.Print.PrintFramework 1136 * @since arkts {'1.1':'11','1.2':'20'} 1137 * @arkts 1.1&1.2 1138 */ 1139 PRINT_FILE_CREATION_FAILED = 1, 1140 1141 /** 1142 * Print file created success but unrendered. 1143 * @syscap SystemCapability.Print.PrintFramework 1144 * @since arkts {'1.1':'11','1.2':'20'} 1145 * @arkts 1.1&1.2 1146 */ 1147 PRINT_FILE_CREATED_UNRENDERED = 2, 1148 } 1149 1150 /** 1151 * Enumeration of Printer State. 1152 * @enum { int } PrinterState 1153 * @syscap SystemCapability.Print.PrintFramework 1154 * @since arkts {'1.1':'14','1.2':'20'} 1155 * @arkts 1.1&1.2 1156 */ 1157 enum PrinterState { 1158 /** 1159 * New printers arrival. 1160 * @syscap SystemCapability.Print.PrintFramework 1161 * @since arkts {'1.1':'14','1.2':'20'} 1162 * @arkts 1.1&1.2 1163 */ 1164 PRINTER_ADDED = 0, 1165 1166 /** 1167 * Printer lost. 1168 * @syscap SystemCapability.Print.PrintFramework 1169 * @since arkts {'1.1':'14','1.2':'20'} 1170 * @arkts 1.1&1.2 1171 */ 1172 PRINTER_REMOVED = 1, 1173 1174 /** 1175 * Printer update. 1176 * @syscap SystemCapability.Print.PrintFramework 1177 * @since arkts {'1.1':'14','1.2':'20'} 1178 * @arkts 1.1&1.2 1179 */ 1180 PRINTER_CAPABILITY_UPDATED = 2, 1181 1182 /** 1183 * Printer has been connected. 1184 * @syscap SystemCapability.Print.PrintFramework 1185 * @since arkts {'1.1':'14','1.2':'20'} 1186 * @arkts 1.1&1.2 1187 */ 1188 PRINTER_CONNECTED = 3, 1189 1190 /** 1191 * Printer has been disconnected. 1192 * @syscap SystemCapability.Print.PrintFramework 1193 * @since arkts {'1.1':'14','1.2':'20'} 1194 * @arkts 1.1&1.2 1195 */ 1196 PRINTER_DISCONNECTED = 4, 1197 1198 /** 1199 * Printer is working. 1200 * @syscap SystemCapability.Print.PrintFramework 1201 * @since arkts {'1.1':'14','1.2':'20'} 1202 * @arkts 1.1&1.2 1203 */ 1204 PRINTER_RUNNING = 5, 1205 } 1206 1207 /** 1208 * Enumeration of Print Job State. 1209 * @enum { int } PrintJobState 1210 * @syscap SystemCapability.Print.PrintFramework 1211 * @since arkts {'1.1':'14','1.2':'20'} 1212 * @arkts 1.1&1.2 1213 */ 1214 enum PrintJobState { 1215 /** 1216 * Initial state of print job. 1217 * @syscap SystemCapability.Print.PrintFramework 1218 * @since arkts {'1.1':'14','1.2':'20'} 1219 * @arkts 1.1&1.2 1220 */ 1221 PRINT_JOB_PREPARE = 0, 1222 1223 /** 1224 * Deliver print job to the printer. 1225 * @syscap SystemCapability.Print.PrintFramework 1226 * @since arkts {'1.1':'14','1.2':'20'} 1227 * @arkts 1.1&1.2 1228 */ 1229 PRINT_JOB_QUEUED = 1, 1230 1231 /** 1232 * Executing print job. 1233 * @syscap SystemCapability.Print.PrintFramework 1234 * @since arkts {'1.1':'14','1.2':'20'} 1235 * @arkts 1.1&1.2 1236 */ 1237 PRINT_JOB_RUNNING = 2, 1238 1239 /** 1240 * Print job has been blocked. 1241 * @syscap SystemCapability.Print.PrintFramework 1242 * @since arkts {'1.1':'14','1.2':'20'} 1243 * @arkts 1.1&1.2 1244 */ 1245 PRINT_JOB_BLOCKED = 3, 1246 1247 /** 1248 * Print job completed. 1249 * @syscap SystemCapability.Print.PrintFramework 1250 * @since arkts {'1.1':'14','1.2':'20'} 1251 * @arkts 1.1&1.2 1252 */ 1253 PRINT_JOB_COMPLETED = 4, 1254 } 1255 1256 /** 1257 * Enumeration of Print Job Sub State. 1258 * @enum { int } PrintJobSubState 1259 * @syscap SystemCapability.Print.PrintFramework 1260 * @since arkts {'1.1':'14','1.2':'20'} 1261 * @arkts 1.1&1.2 1262 */ 1263 enum PrintJobSubState { 1264 /** 1265 * Print job succeed. 1266 * @syscap SystemCapability.Print.PrintFramework 1267 * @since arkts {'1.1':'14','1.2':'20'} 1268 * @arkts 1.1&1.2 1269 */ 1270 PRINT_JOB_COMPLETED_SUCCESS = 0, 1271 1272 /** 1273 * Print job fail. 1274 * @syscap SystemCapability.Print.PrintFramework 1275 * @since arkts {'1.1':'14','1.2':'20'} 1276 * @arkts 1.1&1.2 1277 */ 1278 PRINT_JOB_COMPLETED_FAILED = 1, 1279 1280 /** 1281 * Print job has been cancelled. 1282 * @syscap SystemCapability.Print.PrintFramework 1283 * @since arkts {'1.1':'14','1.2':'20'} 1284 * @arkts 1.1&1.2 1285 */ 1286 PRINT_JOB_COMPLETED_CANCELLED = 2, 1287 1288 /** 1289 * Print job has been corrupted. 1290 * @syscap SystemCapability.Print.PrintFramework 1291 * @since arkts {'1.1':'14','1.2':'20'} 1292 * @arkts 1.1&1.2 1293 */ 1294 PRINT_JOB_COMPLETED_FILE_CORRUPTED = 3, 1295 1296 /** 1297 * Print is offline. 1298 * @syscap SystemCapability.Print.PrintFramework 1299 * @since arkts {'1.1':'14','1.2':'20'} 1300 * @arkts 1.1&1.2 1301 */ 1302 PRINT_JOB_BLOCK_OFFLINE = 4, 1303 1304 /** 1305 * Print is occupied by other process. 1306 * @syscap SystemCapability.Print.PrintFramework 1307 * @since arkts {'1.1':'14','1.2':'20'} 1308 * @arkts 1.1&1.2 1309 */ 1310 PRINT_JOB_BLOCK_BUSY = 5, 1311 1312 /** 1313 * Print job has been cancelled. 1314 * @syscap SystemCapability.Print.PrintFramework 1315 * @since arkts {'1.1':'14','1.2':'20'} 1316 * @arkts 1.1&1.2 1317 */ 1318 PRINT_JOB_BLOCK_CANCELLED = 6, 1319 1320 /** 1321 * Print out of paper. 1322 * @syscap SystemCapability.Print.PrintFramework 1323 * @since arkts {'1.1':'14','1.2':'20'} 1324 * @arkts 1.1&1.2 1325 */ 1326 PRINT_JOB_BLOCK_OUT_OF_PAPER = 7, 1327 1328 /** 1329 * Print out of ink. 1330 * @syscap SystemCapability.Print.PrintFramework 1331 * @since arkts {'1.1':'14','1.2':'20'} 1332 * @arkts 1.1&1.2 1333 */ 1334 PRINT_JOB_BLOCK_OUT_OF_INK = 8, 1335 1336 /** 1337 * Print out of toner. 1338 * @syscap SystemCapability.Print.PrintFramework 1339 * @since arkts {'1.1':'14','1.2':'20'} 1340 * @arkts 1.1&1.2 1341 */ 1342 PRINT_JOB_BLOCK_OUT_OF_TONER = 9, 1343 1344 /** 1345 * Print paper jam. 1346 * @syscap SystemCapability.Print.PrintFramework 1347 * @since arkts {'1.1':'14','1.2':'20'} 1348 * @arkts 1.1&1.2 1349 */ 1350 PRINT_JOB_BLOCK_JAMMED = 10, 1351 1352 /** 1353 * Print cover open. 1354 * @syscap SystemCapability.Print.PrintFramework 1355 * @since arkts {'1.1':'14','1.2':'20'} 1356 * @arkts 1.1&1.2 1357 */ 1358 PRINT_JOB_BLOCK_DOOR_OPEN = 11, 1359 1360 /** 1361 * Print service request. 1362 * @syscap SystemCapability.Print.PrintFramework 1363 * @since arkts {'1.1':'14','1.2':'20'} 1364 * @arkts 1.1&1.2 1365 */ 1366 PRINT_JOB_BLOCK_SERVICE_REQUEST = 12, 1367 1368 /** 1369 * Print low on ink. 1370 * @syscap SystemCapability.Print.PrintFramework 1371 * @since arkts {'1.1':'14','1.2':'20'} 1372 * @arkts 1.1&1.2 1373 */ 1374 PRINT_JOB_BLOCK_LOW_ON_INK = 13, 1375 1376 /** 1377 * Print low on toner. 1378 * @syscap SystemCapability.Print.PrintFramework 1379 * @since arkts {'1.1':'14','1.2':'20'} 1380 * @arkts 1.1&1.2 1381 */ 1382 PRINT_JOB_BLOCK_LOW_ON_TONER = 14, 1383 1384 /** 1385 * Print really low on ink. 1386 * @syscap SystemCapability.Print.PrintFramework 1387 * @since arkts {'1.1':'14','1.2':'20'} 1388 * @arkts 1.1&1.2 1389 */ 1390 PRINT_JOB_BLOCK_REALLY_LOW_ON_INK = 15, 1391 1392 /** 1393 * Print bad certification. 1394 * @syscap SystemCapability.Print.PrintFramework 1395 * @since arkts {'1.1':'14','1.2':'20'} 1396 * @arkts 1.1&1.2 1397 */ 1398 PRINT_JOB_BLOCK_BAD_CERTIFICATE = 16, 1399 1400 /** 1401 * Print printer driver exception. 1402 * @syscap SystemCapability.Print.PrintFramework 1403 * @since 20 1404 * @arkts 1.1&1.2 1405 */ 1406 PRINT_JOB_BLOCK_DRIVER_EXCEPTION = 17, 1407 1408 /** 1409 * Print an error occurred when printing the account. 1410 * @syscap SystemCapability.Print.PrintFramework 1411 * @since arkts {'1.1':'14','1.2':'20'} 1412 * @arkts 1.1&1.2 1413 */ 1414 PRINT_JOB_BLOCK_ACCOUNT_ERROR = 18, 1415 1416 /** 1417 * Print the printing permission is abnormal. 1418 * @syscap SystemCapability.Print.PrintFramework 1419 * @since arkts {'1.1':'14','1.2':'20'} 1420 * @arkts 1.1&1.2 1421 */ 1422 PRINT_JOB_BLOCK_PRINT_PERMISSION_ERROR = 19, 1423 1424 /** 1425 * Print color printing permission exception. 1426 * @syscap SystemCapability.Print.PrintFramework 1427 * @since arkts {'1.1':'14','1.2':'20'} 1428 * @arkts 1.1&1.2 1429 */ 1430 PRINT_JOB_BLOCK_PRINT_COLOR_PERMISSION_ERROR = 20, 1431 1432 /** 1433 * Print the device is not connected to the network. 1434 * @syscap SystemCapability.Print.PrintFramework 1435 * @since arkts {'1.1':'14','1.2':'20'} 1436 * @arkts 1.1&1.2 1437 */ 1438 PRINT_JOB_BLOCK_NETWORK_ERROR = 21, 1439 1440 /** 1441 * Print unable to connect to the server. 1442 * @syscap SystemCapability.Print.PrintFramework 1443 * @since arkts {'1.1':'14','1.2':'20'} 1444 * @arkts 1.1&1.2 1445 */ 1446 PRINT_JOB_BLOCK_SERVER_CONNECTION_ERROR = 22, 1447 1448 /** 1449 * Print large file exception. 1450 * @syscap SystemCapability.Print.PrintFramework 1451 * @since arkts {'1.1':'14','1.2':'20'} 1452 * @arkts 1.1&1.2 1453 */ 1454 PRINT_JOB_BLOCK_LARGE_FILE_ERROR = 23, 1455 1456 /** 1457 * Print file parsing exception. 1458 * @syscap SystemCapability.Print.PrintFramework 1459 * @since arkts {'1.1':'14','1.2':'20'} 1460 * @arkts 1.1&1.2 1461 */ 1462 PRINT_JOB_BLOCK_FILE_PARSING_ERROR = 24, 1463 1464 /** 1465 * Print the file conversion is too slow. 1466 * @syscap SystemCapability.Print.PrintFramework 1467 * @since arkts {'1.1':'14','1.2':'20'} 1468 * @arkts 1.1&1.2 1469 */ 1470 PRINT_JOB_BLOCK_SLOW_FILE_CONVERSION = 25, 1471 1472 /** 1473 * Print uploading file. 1474 * @syscap SystemCapability.Print.PrintFramework 1475 * @since arkts {'1.1':'14','1.2':'20'} 1476 * @arkts 1.1&1.2 1477 */ 1478 PRINT_JOB_RUNNING_UPLOADING_FILES = 26, 1479 1480 /** 1481 * Print converting files. 1482 * @syscap SystemCapability.Print.PrintFramework 1483 * @since arkts {'1.1':'14','1.2':'20'} 1484 * @arkts 1.1&1.2 1485 */ 1486 PRINT_JOB_RUNNING_CONVERTING_FILES = 27, 1487 1488 /** 1489 * Print file uploading exception. 1490 * @syscap SystemCapability.Print.PrintFramework 1491 * @since arkts {'1.1':'18','1.2':'20'} 1492 * @arkts 1.1&1.2 1493 */ 1494 PRINT_JOB_BLOCK_FILE_UPLOADING_ERROR = 30, 1495 1496 /** 1497 * Print driver file missing. 1498 * @syscap SystemCapability.Print.PrintFramework 1499 * @since 20 1500 * @arkts 1.1&1.2 1501 */ 1502 PRINT_JOB_BLOCK_DRIVER_MISSING = 34, 1503 1504 /** 1505 * Print job interrupt. 1506 * @syscap SystemCapability.Print.PrintFramework 1507 * @since 20 1508 * @arkts 1.1&1.2 1509 */ 1510 PRINT_JOB_BLOCK_INTERRUPT = 35, 1511 1512 /** 1513 * Print on an unavailable printer. 1514 * @syscap SystemCapability.Print.PrintFramework 1515 * @since 20 1516 * @arkts 1.1&1.2 1517 */ 1518 PRINT_JOB_BLOCK_PRINTER_UNAVAILABLE = 98, 1519 1520 /** 1521 * Print unknown issue. 1522 * @syscap SystemCapability.Print.PrintFramework 1523 * @since arkts {'1.1':'14','1.2':'20'} 1524 * @arkts 1.1&1.2 1525 */ 1526 PRINT_JOB_BLOCK_UNKNOWN = 99, 1527 } 1528 1529 /** 1530 * Enumeration of Print error Code. 1531 * @enum { int } PrintErrorCode 1532 * @syscap SystemCapability.Print.PrintFramework 1533 * @since arkts {'1.1':'14','1.2':'20'} 1534 * @arkts 1.1&1.2 1535 */ 1536 enum PrintErrorCode { 1537 /** 1538 * No error. 1539 * @syscap SystemCapability.Print.PrintFramework 1540 * @since arkts {'1.1':'14','1.2':'20'} 1541 * @arkts 1.1&1.2 1542 */ 1543 E_PRINT_NONE = 0, 1544 1545 /** 1546 * No permission. 1547 * @syscap SystemCapability.Print.PrintFramework 1548 * @since arkts {'1.1':'14','1.2':'20'} 1549 * @arkts 1.1&1.2 1550 */ 1551 E_PRINT_NO_PERMISSION = 201, 1552 1553 /** 1554 * Invalid parameter. 1555 * @syscap SystemCapability.Print.PrintFramework 1556 * @since arkts {'1.1':'14','1.2':'20'} 1557 * @arkts 1.1&1.2 1558 */ 1559 E_PRINT_INVALID_PARAMETER = 401, 1560 1561 /** 1562 * Generic failure of print. 1563 * @syscap SystemCapability.Print.PrintFramework 1564 * @since arkts {'1.1':'14','1.2':'20'} 1565 * @arkts 1.1&1.2 1566 */ 1567 E_PRINT_GENERIC_FAILURE = 13100001, 1568 1569 /** 1570 * RPC failure. 1571 * @syscap SystemCapability.Print.PrintFramework 1572 * @since arkts {'1.1':'14','1.2':'20'} 1573 * @arkts 1.1&1.2 1574 */ 1575 E_PRINT_RPC_FAILURE = 13100002, 1576 1577 /** 1578 * Failure of print service. 1579 * @syscap SystemCapability.Print.PrintFramework 1580 * @since arkts {'1.1':'14','1.2':'20'} 1581 * @arkts 1.1&1.2 1582 */ 1583 E_PRINT_SERVER_FAILURE = 13100003, 1584 1585 /** 1586 * Invalid print extension. 1587 * @syscap SystemCapability.Print.PrintFramework 1588 * @since arkts {'1.1':'14','1.2':'20'} 1589 * @arkts 1.1&1.2 1590 */ 1591 E_PRINT_INVALID_EXTENSION = 13100004, 1592 1593 /** 1594 * Invalid printer. 1595 * @syscap SystemCapability.Print.PrintFramework 1596 * @since arkts {'1.1':'14','1.2':'20'} 1597 * @arkts 1.1&1.2 1598 */ 1599 E_PRINT_INVALID_PRINTER = 13100005, 1600 1601 /** 1602 * Invalid print job. 1603 * @syscap SystemCapability.Print.PrintFramework 1604 * @since arkts {'1.1':'14','1.2':'20'} 1605 * @arkts 1.1&1.2 1606 */ 1607 E_PRINT_INVALID_PRINT_JOB = 13100006, 1608 1609 /** 1610 * File i/o error. 1611 * @syscap SystemCapability.Print.PrintFramework 1612 * @since arkts {'1.1':'14','1.2':'20'} 1613 * @arkts 1.1&1.2 1614 */ 1615 E_PRINT_FILE_IO = 13100007, 1616 1617 /** 1618 * Number of files exceeding the upper limit. 1619 * @syscap SystemCapability.Print.PrintFramework 1620 * @since arkts {'1.1':'18','1.2':'20'} 1621 * @arkts 1.1&1.2 1622 */ 1623 E_PRINT_TOO_MANY_FILES = 13100010, 1624 } 1625 1626 /** 1627 * Enumeration of application event. 1628 * @enum { int } ApplicationEvent 1629 * @syscap SystemCapability.Print.PrintFramework 1630 * @since arkts {'1.1':'14','1.2':'20'} 1631 * @arkts 1.1&1.2 1632 */ 1633 enum ApplicationEvent { 1634 /** 1635 * Application created. 1636 * @syscap SystemCapability.Print.PrintFramework 1637 * @since arkts {'1.1':'14','1.2':'20'} 1638 * @arkts 1.1&1.2 1639 */ 1640 APPLICATION_CREATED = 0, 1641 1642 /** 1643 * Application closed for printing started. 1644 * @syscap SystemCapability.Print.PrintFramework 1645 * @since arkts {'1.1':'14','1.2':'20'} 1646 * @arkts 1.1&1.2 1647 */ 1648 APPLICATION_CLOSED_FOR_STARTED = 1, 1649 1650 /** 1651 * Application closed for printing canceled. 1652 * @syscap SystemCapability.Print.PrintFramework 1653 * @since arkts {'1.1':'14','1.2':'20'} 1654 * @arkts 1.1&1.2 1655 */ 1656 APPLICATION_CLOSED_FOR_CANCELED = 2, 1657 } 1658 1659 /** 1660 * defines print ExtensionInfo. 1661 * @typedef PrinterExtensionInfo 1662 * @syscap SystemCapability.Print.PrintFramework 1663 * @systemapi Hide this for inner system use. 1664 * @since arkts {'1.1':'10','1.2':'20'} 1665 * @arkts 1.1&1.2 1666 */ 1667 interface PrinterExtensionInfo { 1668 /** 1669 * Extension id of printer extension. 1670 * @type { string } 1671 * @syscap SystemCapability.Print.PrintFramework 1672 * @systemapi 1673 * @since arkts {'1.1':'10','1.2':'20'} 1674 * @arkts 1.1&1.2 1675 */ 1676 extensionId: string; 1677 1678 /** 1679 * Vendor id of extension. 1680 * @type { string } 1681 * @syscap SystemCapability.Print.PrintFramework 1682 * @systemapi 1683 * @since arkts {'1.1':'10','1.2':'20'} 1684 * @arkts 1.1&1.2 1685 */ 1686 vendorId: string; 1687 1688 /** 1689 * Vendor name. 1690 * @type { string } 1691 * @syscap SystemCapability.Print.PrintFramework 1692 * @systemapi 1693 * @since arkts {'1.1':'10','1.2':'20'} 1694 * @arkts 1.1&1.2 1695 */ 1696 vendorName: string; 1697 1698 /** 1699 * Vendor icon. 1700 * @type { int } 1701 * @syscap SystemCapability.Print.PrintFramework 1702 * @systemapi 1703 * @since arkts {'1.1':'10','1.2':'20'} 1704 * @arkts 1.1&1.2 1705 */ 1706 vendorIcon: int; 1707 1708 /** 1709 * Version of current printer extension. 1710 * @type { string } 1711 * @syscap SystemCapability.Print.PrintFramework 1712 * @systemapi 1713 * @since arkts {'1.1':'10','1.2':'20'} 1714 * @arkts 1.1&1.2 1715 */ 1716 version: string; 1717 } 1718 1719 /** 1720 * Get all printer extension installed. 1721 * @permission ohos.permission.MANAGE_PRINT_JOB 1722 * @param { AsyncCallback<Array<PrinterExtensionInfo>> } callback - The callback function for handling the extension list found. 1723 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1724 * @throws { BusinessError } 202 - not system application 1725 * @syscap SystemCapability.Print.PrintFramework 1726 * @systemapi Hide this for inner system use. 1727 * @since arkts {'1.1':'10','1.2':'20'} 1728 * @arkts 1.1&1.2 1729 */ 1730 function queryAllPrinterExtensionInfos(callback: AsyncCallback<Array<PrinterExtensionInfo>>): void; 1731 1732 /** 1733 * Get all printer extension installed. 1734 * @permission ohos.permission.MANAGE_PRINT_JOB 1735 * @returns { Promise<Array<PrinterExtensionInfo>> } the promise returned by the function. 1736 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1737 * @throws { BusinessError } 202 - not system application 1738 * @syscap SystemCapability.Print.PrintFramework 1739 * @systemapi Hide this for inner system use. 1740 * @since arkts {'1.1':'10','1.2':'20'} 1741 * @arkts 1.1&1.2 1742 */ 1743 function queryAllPrinterExtensionInfos(): Promise<Array<PrinterExtensionInfo>>; 1744 1745 /** 1746 * Load the specific printer extension and start to discover printer. 1747 * @permission ohos.permission.MANAGE_PRINT_JOB 1748 * @param { Array<string> } extensionList - Indicates the list of printer extension. 1749 * empty list of extensionList Indicates to find printer with all installed extension. 1750 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 1751 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1752 * @throws { BusinessError } 202 - not system application 1753 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1754 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1755 * @syscap SystemCapability.Print.PrintFramework 1756 * @systemapi Hide this for inner system use. 1757 * @since 10 1758 */ 1759 /** 1760 * Load the specific printer extension and start to discover printer. 1761 * @permission ohos.permission.MANAGE_PRINT_JOB or ohos.permission.PRINT 1762 * @param { Array<string> } extensionList - Indicates the list of printer extension. 1763 * empty list of extensionList Indicates to find printer with all installed extension. 1764 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 1765 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1766 * @syscap SystemCapability.Print.PrintFramework 1767 * @since 20 1768 * @arkts 1.1&1.2 1769 */ 1770 function startDiscoverPrinter(extensionList: Array<string>, callback: AsyncCallback<void>): void; 1771 1772 /** 1773 * Load the specific printer extension and start to discover printer. 1774 * @permission ohos.permission.MANAGE_PRINT_JOB 1775 * @param { Array<string> } extensionList - Indicates the list of printer extension. 1776 * empty list of extensionList Indicates to find printer with all installed extension. 1777 * @returns { Promise<void> } the promise returned by the function. 1778 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1779 * @throws { BusinessError } 202 - not system application 1780 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1781 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1782 * @syscap SystemCapability.Print.PrintFramework 1783 * @systemapi Hide this for inner system use. 1784 * @since 10 1785 */ 1786 /** 1787 * Load the specific printer extension and start to discover printer. 1788 * @permission ohos.permission.MANAGE_PRINT_JOB or ohos.permission.PRINT 1789 * @param { Array<string> } extensionList - Indicates the list of printer extension. 1790 * empty list of extensionList Indicates to find printer with all installed extension. 1791 * @returns { Promise<void> } the promise returned by the function. 1792 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1793 * @syscap SystemCapability.Print.PrintFramework 1794 * @since 20 1795 * @arkts 1.1&1.2 1796 */ 1797 function startDiscoverPrinter(extensionList: Array<string>): Promise<void>; 1798 1799 /** 1800 * Stop discovering the printer with specific printer extension. 1801 * @permission ohos.permission.MANAGE_PRINT_JOB 1802 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 1803 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1804 * @throws { BusinessError } 202 - not system application 1805 * @syscap SystemCapability.Print.PrintFramework 1806 * @systemapi Hide this for inner system use. 1807 * @since 10 1808 */ 1809 /** 1810 * Stop discovering the printer with specific printer extension. 1811 * @permission ohos.permission.MANAGE_PRINT_JOB or ohos.permission.PRINT 1812 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 1813 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1814 * @syscap SystemCapability.Print.PrintFramework 1815 * @since 20 1816 * @arkts 1.1&1.2 1817 */ 1818 function stopDiscoverPrinter(callback: AsyncCallback<void>): void; 1819 1820 /** 1821 * Stop discovering the printer with specific printer extension. 1822 * @permission ohos.permission.MANAGE_PRINT_JOB 1823 * @returns { Promise<void> } the promise returned by the function. 1824 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1825 * @throws { BusinessError } 202 - not system application 1826 * @syscap SystemCapability.Print.PrintFramework 1827 * @systemapi Hide this for inner system use. 1828 * @since 10 1829 */ 1830 /** 1831 * Stop discovering the printer with specific printer extension. 1832 * @permission ohos.permission.MANAGE_PRINT_JOB or ohos.permission.PRINT 1833 * @returns { Promise<void> } the promise returned by the function. 1834 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1835 * @syscap SystemCapability.Print.PrintFramework 1836 * @since 20 1837 * @arkts 1.1&1.2 1838 */ 1839 function stopDiscoverPrinter(): Promise<void>; 1840 1841 /** 1842 * Connect the specific printer. 1843 * @permission ohos.permission.MANAGE_PRINT_JOB 1844 * @param { string } printerId - Indicates id of the printer. 1845 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 1846 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1847 * @throws { BusinessError } 202 - not system application 1848 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1849 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1850 * @syscap SystemCapability.Print.PrintFramework 1851 * @systemapi Hide this for inner system use. 1852 * @since 10 1853 */ 1854 /** 1855 * Connect the specific printer. 1856 * @permission ohos.permission.MANAGE_PRINT_JOB or ohos.permission.PRINT 1857 * @param { string } printerId - Indicates id of the printer. 1858 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 1859 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1860 * @syscap SystemCapability.Print.PrintFramework 1861 * @since 20 1862 * @arkts 1.1&1.2 1863 */ 1864 function connectPrinter(printerId: string, callback: AsyncCallback<void>): void; 1865 1866 /** 1867 * Connect the specific printer. 1868 * @permission ohos.permission.MANAGE_PRINT_JOB 1869 * @param { string } printerId - Indicates id of the printer. 1870 * @returns { Promise<void> } the promise returned by the function. 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: 1874 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1875 * @syscap SystemCapability.Print.PrintFramework 1876 * @systemapi Hide this for inner system use. 1877 * @since 10 1878 */ 1879 /** 1880 * Connect the specific printer. 1881 * @permission ohos.permission.MANAGE_PRINT_JOB or ohos.permission.PRINT 1882 * @param { string } printerId - Indicates id of the printer. 1883 * @returns { Promise<void> } the promise returned by the function. 1884 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1885 * @syscap SystemCapability.Print.PrintFramework 1886 * @since 20 1887 * @arkts 1.1&1.2 1888 */ 1889 function connectPrinter(printerId: string): Promise<void>; 1890 1891 /** 1892 * Disconnect the specific printer. 1893 * @permission ohos.permission.MANAGE_PRINT_JOB 1894 * @param { string } printerId - Indicates id of the printer. 1895 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 1896 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1897 * @throws { BusinessError } 202 - not system application 1898 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1899 * @syscap SystemCapability.Print.PrintFramework 1900 * @systemapi Hide this for inner system use. 1901 * @since arkts {'1.1':'10','1.2':'20'} 1902 * @arkts 1.1&1.2 1903 */ 1904 function disconnectPrinter(printerId: string, callback: AsyncCallback<void>): void; 1905 1906 /** 1907 * Disconnect the specific printer. 1908 * @permission ohos.permission.MANAGE_PRINT_JOB 1909 * @param { string } printerId - Indicates id of the printer. 1910 * @returns { Promise<void> } the promise returned by the function. 1911 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1912 * @throws { BusinessError } 202 - not system application 1913 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1914 * @syscap SystemCapability.Print.PrintFramework 1915 * @systemapi Hide this for inner system use. 1916 * @since arkts {'1.1':'10','1.2':'20'} 1917 * @arkts 1.1&1.2 1918 */ 1919 function disconnectPrinter(printerId: string): Promise<void>; 1920 1921 /** 1922 * Query capability for the specific printer. 1923 * @permission ohos.permission.MANAGE_PRINT_JOB 1924 * @param { string } printerId - Indicates id of the printer. 1925 * @param { AsyncCallback<void> } callback - The callback function for capability from printer. 1926 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1927 * @throws { BusinessError } 202 - not system application 1928 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1929 * @syscap SystemCapability.Print.PrintFramework 1930 * @systemapi Hide this for inner system use. 1931 * @since arkts {'1.1':'10','1.2':'20'} 1932 * @arkts 1.1&1.2 1933 */ 1934 function queryPrinterCapability(printerId: string, callback: AsyncCallback<void>): void; 1935 1936 /** 1937 * Query capability for the specific printer. 1938 * @permission ohos.permission.MANAGE_PRINT_JOB 1939 * @param { string } printerId - Indicates id of the printer. 1940 * @returns { Promise<void> } the promise returned by the function. 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 arkts {'1.1':'10','1.2':'20'} 1947 * @arkts 1.1&1.2 1948 */ 1949 function queryPrinterCapability(printerId: string): Promise<void>; 1950 1951 /** 1952 * Start print job. 1953 * @permission ohos.permission.MANAGE_PRINT_JOB 1954 * @param { PrintJob } jobInfo - Indicates the information of print job. 1955 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 1956 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1957 * @throws { BusinessError } 202 - not system application 1958 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1959 * @syscap SystemCapability.Print.PrintFramework 1960 * @systemapi Hide this for inner system use. 1961 * @since arkts {'1.1':'10','1.2':'20'} 1962 * @arkts 1.1&1.2 1963 */ 1964 function startPrintJob(jobInfo: PrintJob, callback: AsyncCallback<void>): void; 1965 1966 /** 1967 * Start print job. 1968 * @permission ohos.permission.MANAGE_PRINT_JOB 1969 * @param { PrintJob } jobInfo - Indicates the information of print job. 1970 * @returns { Promise<void> } the promise returned by the function. 1971 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1972 * @throws { BusinessError } 202 - not system application 1973 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1974 * @syscap SystemCapability.Print.PrintFramework 1975 * @systemapi Hide this for inner system use. 1976 * @since arkts {'1.1':'10','1.2':'20'} 1977 * @arkts 1.1&1.2 1978 */ 1979 function startPrintJob(jobInfo: PrintJob): Promise<void>; 1980 1981 /** 1982 * Cancel the print job has been sent to printer. 1983 * @permission ohos.permission.MANAGE_PRINT_JOB 1984 * @param { string } jobId - Indicates the specific print job. 1985 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 1986 * @throws { BusinessError } 201 - the application does not have permission to call this function. 1987 * @throws { BusinessError } 202 - not system application 1988 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 1989 * @syscap SystemCapability.Print.PrintFramework 1990 * @systemapi Hide this for inner system use. 1991 * @since arkts {'1.1':'10','1.2':'20'} 1992 * @arkts 1.1&1.2 1993 */ 1994 function cancelPrintJob(jobId: string, callback: AsyncCallback<void>): void; 1995 1996 /** 1997 * Cancel the print job has been sent to printer. 1998 * @permission ohos.permission.MANAGE_PRINT_JOB 1999 * @param { string } jobId - Indicates the specific print job. 2000 * @returns { Promise<void> } the promise returned by the function. 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 arkts {'1.1':'10','1.2':'20'} 2007 * @arkts 1.1&1.2 2008 */ 2009 function cancelPrintJob(jobId: string): Promise<void>; 2010 2011 /** 2012 * Restart the print job has been sent. 2013 * @permission ohos.permission.MANAGE_PRINT_JOB 2014 * @param { string } jobId - Indicates the specific print job. 2015 * @returns { Promise<void> } the promise returned by the function. 2016 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2017 * @throws { BusinessError } 202 - not system application 2018 * @syscap SystemCapability.Print.PrintFramework 2019 * @systemapi Hide this for inner system use. 2020 * @since 20 2021 * @arkts 1.1&1.2 2022 */ 2023 function restartPrintJob(jobId: string): Promise<void>; 2024 2025 /** 2026 * Request preview of the print job. 2027 * @permission ohos.permission.MANAGE_PRINT_JOB 2028 * @param { PrintJob } jobInfo - Indicates the information of print job. 2029 * @param { Callback<int> } callback - The callback function for indcating the result of API execution. 2030 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2031 * @throws { BusinessError } 202 - not system application 2032 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2033 * @syscap SystemCapability.Print.PrintFramework 2034 * @systemapi Hide this for inner system use. 2035 * @since arkts {'1.1':'10','1.2':'20'} 2036 * @arkts 1.1&1.2 2037 */ 2038 function requestPrintPreview(jobInfo: PrintJob, callback: Callback<int>): void; 2039 2040 /** 2041 * Request preview of the print job. 2042 * @permission ohos.permission.MANAGE_PRINT_JOB 2043 * @param { PrintJob } jobInfo - Indicates the information of print job. 2044 * @returns { Promise<int> } 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 arkts {'1.1':'10','1.2':'20'} 2051 * @arkts 1.1&1.2 2052 */ 2053 function requestPrintPreview(jobInfo: PrintJob): Promise<int>; 2054 2055 /** 2056 * Register event callback for the state change of printer. 2057 * @permission ohos.permission.MANAGE_PRINT_JOB 2058 * @param { 'printerStateChange' } type - Indicates state change of printer. 2059 * @param { function } callback - The callback function for state change of printer. 2060 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2061 * @throws { BusinessError } 202 - not system application 2062 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2063 * @syscap SystemCapability.Print.PrintFramework 2064 * @systemapi Hide this for inner system use. 2065 * @since arkts {'1.1':'10','1.2':'20'} 2066 * @arkts 1.1&1.2 2067 */ 2068 function on(type: 'printerStateChange', callback: (state: PrinterState, info: PrinterInfo) => void): void; 2069 2070 /** 2071 * Unregister event callback for the state change of printer. 2072 * @permission ohos.permission.MANAGE_PRINT_JOB 2073 * @param { 'printerStateChange' } type - Indicates state change of printer. 2074 * @param { Callback<boolean> } callback - The callback function for state change of printer. 2075 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2076 * @throws { BusinessError } 202 - not system application 2077 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2078 * @syscap SystemCapability.Print.PrintFramework 2079 * @systemapi Hide this for inner system use. 2080 * @since arkts {'1.1':'10','1.2':'20'} 2081 * @arkts 1.1&1.2 2082 */ 2083 function off(type: 'printerStateChange', callback?: Callback<boolean>): void; 2084 2085 /** 2086 * Register event callback for the state change of print job. 2087 * @permission ohos.permission.MANAGE_PRINT_JOB 2088 * @param { 'jobStateChange' } type - Indicates state change of printer. 2089 * @param { function } callback - The callback function for state change of printer. 2090 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2091 * @throws { BusinessError } 202 - not system application 2092 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2093 * @syscap SystemCapability.Print.PrintFramework 2094 * @systemapi Hide this for inner system use. 2095 * @since arkts {'1.1':'10','1.2':'20'} 2096 * @arkts 1.1&1.2 2097 */ 2098 function on(type: 'jobStateChange', callback: (state: PrintJobState, job: PrintJob) => void): void; 2099 2100 /** 2101 * Unregister event callback for the state change of print job. 2102 * @permission ohos.permission.MANAGE_PRINT_JOB 2103 * @param { 'jobStateChange' } type - Indicates state change of printer. 2104 * @param { Callback<boolean> } callback - The callback function for state change of printer. 2105 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2106 * @throws { BusinessError } 202 - not system application 2107 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2108 * @syscap SystemCapability.Print.PrintFramework 2109 * @systemapi Hide this for inner system use. 2110 * @since arkts {'1.1':'10','1.2':'20'} 2111 * @arkts 1.1&1.2 2112 */ 2113 function off(type: 'jobStateChange', callback?: Callback<boolean>): void; 2114 2115 /** 2116 * Register event callback for the information change of print extension. 2117 * @permission ohos.permission.MANAGE_PRINT_JOB 2118 * @param { 'extInfoChange' } type - Indicates information change of print extension. 2119 * @param { function } callback - The callback function for information change of print extension. 2120 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2121 * @throws { BusinessError } 202 - not system application 2122 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2123 * @syscap SystemCapability.Print.PrintFramework 2124 * @systemapi Hide this for inner system use. 2125 * @since arkts {'1.1':'10','1.2':'20'} 2126 * @arkts 1.1&1.2 2127 */ 2128 function on(type: 'extInfoChange', callback: (extensionId: string, info: string) => void): void; 2129 2130 /** 2131 * Unregister event callback for the information change of print extension. 2132 * @permission ohos.permission.MANAGE_PRINT_JOB 2133 * @param { 'extInfoChange' } type - Indicates state change of printer. 2134 * @param { Callback<boolean> } callback - The callback function for state change of printer. 2135 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2136 * @throws { BusinessError } 202 - not system application 2137 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2138 * @syscap SystemCapability.Print.PrintFramework 2139 * @systemapi Hide this for inner system use. 2140 * @since arkts {'1.1':'10','1.2':'20'} 2141 * @arkts 1.1&1.2 2142 */ 2143 function off(type: 'extInfoChange', callback?: Callback<boolean>): void; 2144 2145 /** 2146 * New printers have been found and notify Print SA. 2147 * @permission ohos.permission.MANAGE_PRINT_JOB 2148 * @param { Array<PrinterInfo> } printers - Indicates new arrived printer lists. 2149 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 2150 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2151 * @throws { BusinessError } 202 - not system application 2152 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2153 * @syscap SystemCapability.Print.PrintFramework 2154 * @systemapi Hide this for inner system use. 2155 * @since arkts {'1.1':'10','1.2':'20'} 2156 * @arkts 1.1&1.2 2157 */ 2158 function addPrinters(printers: Array<PrinterInfo>, callback: AsyncCallback<void>): void; 2159 2160 /** 2161 * New printers have been found and notify Print SA. 2162 * @permission ohos.permission.MANAGE_PRINT_JOB 2163 * @param { Array<PrinterInfo> } printers - Indicates new arrived printer lists. 2164 * @returns { Promise<void> } the promise returned by the function. 2165 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2166 * @throws { BusinessError } 202 - not system application 2167 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2168 * @syscap SystemCapability.Print.PrintFramework 2169 * @systemapi Hide this for inner system use. 2170 * @since arkts {'1.1':'10','1.2':'20'} 2171 * @arkts 1.1&1.2 2172 */ 2173 function addPrinters(printers: Array<PrinterInfo>): Promise<void>; 2174 2175 /** 2176 * Printers have been lost and notify Print SA. 2177 * @permission ohos.permission.MANAGE_PRINT_JOB 2178 * @param { Array<string> } printerIds - Indicates the lost printer lists. 2179 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 2180 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2181 * @throws { BusinessError } 202 - not system application 2182 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2183 * @syscap SystemCapability.Print.PrintFramework 2184 * @systemapi Hide this for inner system use. 2185 * @since arkts {'1.1':'10','1.2':'20'} 2186 * @arkts 1.1&1.2 2187 */ 2188 function removePrinters(printerIds: Array<string>, callback: AsyncCallback<void>): void; 2189 2190 /** 2191 * Printers have been lost and notify Print SA. 2192 * @permission ohos.permission.MANAGE_PRINT_JOB 2193 * @param { Array<string> } printerIds - Indicates the lost printer lists. 2194 * @returns { Promise<void> } the promise returned by the function. 2195 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2196 * @throws { BusinessError } 202 - not system application 2197 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2198 * @syscap SystemCapability.Print.PrintFramework 2199 * @systemapi Hide this for inner system use. 2200 * @since arkts {'1.1':'10','1.2':'20'} 2201 * @arkts 1.1&1.2 2202 */ 2203 function removePrinters(printerIds: Array<string>): Promise<void>; 2204 2205 /** 2206 * Update the information of the specific printers. 2207 * @permission ohos.permission.MANAGE_PRINT_JOB 2208 * @param { Array<PrinterInfo> } printers - Indicates to be updated printer lists. 2209 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 2210 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2211 * @throws { BusinessError } 202 - not system application 2212 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2213 * @syscap SystemCapability.Print.PrintFramework 2214 * @systemapi Hide this for inner system use. 2215 * @since arkts {'1.1':'10','1.2':'20'} 2216 * @arkts 1.1&1.2 2217 */ 2218 function updatePrinters(printers: Array<PrinterInfo>, callback: AsyncCallback<void>): void; 2219 2220 /** 2221 * Update the information of the specific printers. 2222 * @permission ohos.permission.MANAGE_PRINT_JOB 2223 * @param { Array<PrinterInfo> } printers - Indicates to be updated printer lists. 2224 * @returns { Promise<void> } the promise returned by the function. 2225 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2226 * @throws { BusinessError } 202 - not system application 2227 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2228 * @syscap SystemCapability.Print.PrintFramework 2229 * @systemapi Hide this for inner system use. 2230 * @since arkts {'1.1':'10','1.2':'20'} 2231 * @arkts 1.1&1.2 2232 */ 2233 function updatePrinters(printers: Array<PrinterInfo>): Promise<void>; 2234 2235 /** 2236 * Notify Print SA the state of printer has been changed. 2237 * @permission ohos.permission.MANAGE_PRINT_JOB 2238 * @param { string } printerId - Indicates id of the printer. 2239 * @param { PrinterState } state - Indicates state of the printer. 2240 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 2241 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2242 * @throws { BusinessError } 202 - not system application 2243 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2244 * @syscap SystemCapability.Print.PrintFramework 2245 * @systemapi Hide this for inner system use. 2246 * @since arkts {'1.1':'10','1.2':'20'} 2247 * @arkts 1.1&1.2 2248 */ 2249 function updatePrinterState(printerId: string, state: PrinterState, callback: AsyncCallback<void>): void; 2250 2251 /** 2252 * Notify Print SA the state of printer has been changed. 2253 * @permission ohos.permission.MANAGE_PRINT_JOB 2254 * @param { string } printerId - Indicates id of the printer. 2255 * @param { PrinterState } state - Indicates state of the printer. 2256 * @returns { Promise<void> } the promise returned by the function. 2257 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2258 * @throws { BusinessError } 202 - not system application 2259 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2260 * @syscap SystemCapability.Print.PrintFramework 2261 * @systemapi Hide this for inner system use. 2262 * @since arkts {'1.1':'10','1.2':'20'} 2263 * @arkts 1.1&1.2 2264 */ 2265 function updatePrinterState(printerId: string, state: PrinterState): Promise<void>; 2266 2267 /** 2268 * Notify Print SA the state of print job has been changed. 2269 * @permission ohos.permission.MANAGE_PRINT_JOB 2270 * @param { string} jobId - Indicates id of the print job. 2271 * @param { PrintJobState } state - Indicates new state of print job. 2272 * @param { PrintJobSubState } subState - Indicates sub state of print job. 2273 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 2274 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2275 * @throws { BusinessError } 202 - not system application 2276 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2277 * @syscap SystemCapability.Print.PrintFramework 2278 * @systemapi Hide this for inner system use. 2279 * @since arkts {'1.1':'10','1.2':'20'} 2280 * @arkts 1.1&1.2 2281 */ 2282 function updatePrintJobState(jobId: string, state: PrintJobState, subState: PrintJobSubState, callback: AsyncCallback<void>): void; 2283 2284 /** 2285 * Notify Print SA the state of print job has been changed. 2286 * @permission ohos.permission.MANAGE_PRINT_JOB 2287 * @param { string} jobId - Indicates id of the print job. 2288 * @param { PrintJobState } state - Indicates new state of print job. 2289 * @param { PrintJobSubState } subState - Indicates sub state of print job. 2290 * @returns { Promise<void> } the promise returned by the function. 2291 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2292 * @throws { BusinessError } 202 - not system application 2293 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2294 * @syscap SystemCapability.Print.PrintFramework 2295 * @systemapi Hide this for inner system use. 2296 * @since arkts {'1.1':'10','1.2':'20'} 2297 * @arkts 1.1&1.2 2298 */ 2299 function updatePrintJobState(jobId: string, state: PrintJobState, subState: PrintJobSubState): Promise<void>; 2300 2301 /** 2302 * Notify Print SA the state of print extension has been changed. 2303 * @permission ohos.permission.MANAGE_PRINT_JOB 2304 * @param { string } info - Indicates changed information of print extension. 2305 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 2306 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2307 * @throws { BusinessError } 202 - not system application 2308 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2309 * @syscap SystemCapability.Print.PrintFramework 2310 * @systemapi Hide this for inner system use. 2311 * @since arkts {'1.1':'10','1.2':'20'} 2312 * @arkts 1.1&1.2 2313 */ 2314 function updateExtensionInfo(info: string, callback: AsyncCallback<void>): void; 2315 2316 /** 2317 * Notify Print SA the state of print extension has been changed. 2318 * @permission ohos.permission.MANAGE_PRINT_JOB 2319 * @param { string } info - Indicates changed information of print extension. 2320 * @returns { Promise<void> } the promise returned by the function. 2321 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2322 * @throws { BusinessError } 202 - not system application 2323 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2324 * @syscap SystemCapability.Print.PrintFramework 2325 * @systemapi Hide this for inner system use. 2326 * @since arkts {'1.1':'10','1.2':'20'} 2327 * @arkts 1.1&1.2 2328 */ 2329 function updateExtensionInfo(info: string): Promise<void>; 2330 2331 /** 2332 * Get all the printJobs in the queue. 2333 * @permission ohos.permission.MANAGE_PRINT_JOB 2334 * @param { AsyncCallback<void> } callback - The callback function for handling the printJob list found. 2335 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2336 * @throws { BusinessError } 202 - not system application 2337 * @syscap SystemCapability.Print.PrintFramework 2338 * @systemapi Hide this for inner system use. 2339 * @since arkts {'1.1':'10','1.2':'20'} 2340 * @deprecated since 11 2341 * @useinstead print#queryPrintJobList 2342 * @arkts 1.1&1.2 2343 */ 2344 function queryAllPrintJobs(callback: AsyncCallback<void>): void; 2345 2346 /** 2347 * Get all the printJobs in the queue. 2348 * @permission ohos.permission.MANAGE_PRINT_JOB 2349 * @returns { Promise<void> } the promise returned by the function. 2350 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2351 * @throws { BusinessError } 202 - not system application 2352 * @syscap SystemCapability.Print.PrintFramework 2353 * @systemapi Hide this for inner system use. 2354 * @since arkts {'1.1':'10','1.2':'20'} 2355 * @deprecated since 11 2356 * @useinstead print#queryPrintJobList 2357 * @arkts 1.1&1.2 2358 */ 2359 function queryAllPrintJobs(): Promise<void>; 2360 2361 /** 2362 * Get all active printJobs in the queue. 2363 * @permission ohos.permission.MANAGE_PRINT_JOB 2364 * @returns { Promise<PrintJob[]> } Returns a list of all active print jobs. 2365 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2366 * @throws { BusinessError } 202 - not system application 2367 * @syscap SystemCapability.Print.PrintFramework 2368 * @systemapi Hide this for inner system use. 2369 * @since 20 2370 * @arkts 1.1&1.2 2371 */ 2372 function queryAllActivePrintJobs(): Promise<PrintJob[]>; 2373 2374 /** 2375 * Get all the printJobs in the queue. 2376 * @permission ohos.permission.MANAGE_PRINT_JOB 2377 * @param { AsyncCallback<Array<PrintJob>> } callback - The callback function for handling the printJob list found. 2378 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2379 * @throws { BusinessError } 202 - not system application 2380 * @syscap SystemCapability.Print.PrintFramework 2381 * @systemapi Hide this for inner system use. 2382 * @since arkts {'1.1':'11','1.2':'20'} 2383 * @arkts 1.1&1.2 2384 */ 2385 function queryPrintJobList(callback: AsyncCallback<Array<PrintJob>>): void; 2386 2387 /** 2388 * Get all the printJobs in the queue. 2389 * @permission ohos.permission.MANAGE_PRINT_JOB 2390 * @returns { Promise<Array<PrintJob>> } the promise returned by the function. 2391 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2392 * @throws { BusinessError } 202 - not system application 2393 * @syscap SystemCapability.Print.PrintFramework 2394 * @systemapi Hide this for inner system use. 2395 * @since arkts {'1.1':'11','1.2':'20'} 2396 * @arkts 1.1&1.2 2397 */ 2398 function queryPrintJobList(): Promise<Array<PrintJob>>; 2399 2400 /** 2401 * Get printJob by jobId. 2402 * @permission ohos.permission.MANAGE_PRINT_JOB 2403 * @param { string } jobId - Indicates id of the print job. 2404 * @param { AsyncCallback<PrintJob> } callback - The callback function for get printJob by jobId. 2405 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2406 * @throws { BusinessError } 202 - not system application 2407 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2408 * @syscap SystemCapability.Print.PrintFramework 2409 * @systemapi Hide this for inner system use. 2410 * @since arkts {'1.1':'11','1.2':'20'} 2411 * @arkts 1.1&1.2 2412 */ 2413 function queryPrintJobById(jobId: string, callback: AsyncCallback<PrintJob>): void; 2414 2415 /** 2416 * Get printJob by jobId. 2417 * @permission ohos.permission.MANAGE_PRINT_JOB 2418 * @param { string } jobId - Indicates id of the print job. 2419 * @returns { Promise<PrintJob> } the promise returned by the function. 2420 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2421 * @throws { BusinessError } 202 - not system application 2422 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2423 * @syscap SystemCapability.Print.PrintFramework 2424 * @systemapi Hide this for inner system use. 2425 * @since arkts {'1.1':'11','1.2':'20'} 2426 * @arkts 1.1&1.2 2427 */ 2428 function queryPrintJobById(jobId: string): Promise<PrintJob>; 2429 2430 /** 2431 * Start getting print file. 2432 * @permission ohos.permission.MANAGE_PRINT_JOB 2433 * @param { string } jobId - Indicates id of the print job. 2434 * @param { PrintAttributes } printAttributes - Indicates print attributes. 2435 * @param { int } fd - Indicates print file fd. 2436 * @param { Callback<PrintFileCreationState> } onFileStateChanged - The callback function for update the file state. 2437 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2438 * @throws { BusinessError } 202 - not system application 2439 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2440 * @syscap SystemCapability.Print.PrintFramework 2441 * @systemapi Hide this for inner system use. 2442 * @since arkts {'1.1':'11','1.2':'20'} 2443 * @arkts 1.1&1.2 2444 */ 2445 function startGettingPrintFile(jobId: string, printAttributes: PrintAttributes, fd: int, 2446 onFileStateChanged: Callback<PrintFileCreationState>): void; 2447 2448 /** 2449 * Notify print service the information. 2450 * @permission ohos.permission.MANAGE_PRINT_JOB 2451 * @param { string } jobId - Indicates id of the print job. 2452 * @param { 'spooler_closed_for_cancelled' | 'spooler_closed_for_started' } type - Indicates notify information. 2453 * @param { AsyncCallback<void> } callback - The callback function for indcating the result of API execution. 2454 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2455 * @throws { BusinessError } 202 - not system application 2456 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2457 * @syscap SystemCapability.Print.PrintFramework 2458 * @systemapi Hide this for inner system use. 2459 * @since arkts {'1.1':'11','1.2':'20'} 2460 * @arkts 1.1&1.2 2461 */ 2462 function notifyPrintService(jobId: string, type: 'spooler_closed_for_cancelled' | 'spooler_closed_for_started', callback: AsyncCallback<void>): void; 2463 2464 /** 2465 * Notify print service the information. 2466 * @permission ohos.permission.MANAGE_PRINT_JOB 2467 * @param { string } jobId - Indicates id of the print job. 2468 * @param { 'spooler_closed_for_cancelled' | 'spooler_closed_for_started' } type - Indicates notify information. 2469 * @returns { Promise<void> } the promise returned by the function. 2470 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2471 * @throws { BusinessError } 202 - not system application 2472 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2473 * @syscap SystemCapability.Print.PrintFramework 2474 * @systemapi Hide this for inner system use. 2475 * @since arkts {'1.1':'11','1.2':'20'} 2476 * @arkts 1.1&1.2 2477 */ 2478 function notifyPrintService(jobId: string, type: 'spooler_closed_for_cancelled' | 'spooler_closed_for_started'): Promise<void>; 2479 2480 /** 2481 * Get all added printers. 2482 * @permission ohos.permission.MANAGE_PRINT_JOB or ohos.permission.PRINT 2483 * @returns { Promise<Array<string>> } the promise returned by the function. 2484 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2485 * @syscap SystemCapability.Print.PrintFramework 2486 * @since arkts {'1.1':'18','1.2':'20'} 2487 * @arkts 1.1&1.2 2488 */ 2489 function getAddedPrinters(): Promise<Array<string>>; 2490 2491 /** 2492 * Get printer info by printer id. 2493 * @permission ohos.permission.MANAGE_PRINT_JOB 2494 * @param { string } printerId - Indicates id of the printer. 2495 * @returns { Promise<PrinterInfo> } the promise returned by the function. 2496 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2497 * @throws { BusinessError } 202 - not system application 2498 * @throws { BusinessError } 401 - Parameter error. Possible causes: 2499 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2500 * @syscap SystemCapability.Print.PrintFramework 2501 * @systemapi Hide this for inner system use. 2502 * @since arkts {'1.1':'12','1.2':'20'} 2503 * @arkts 1.1&1.2 2504 */ 2505 function getPrinterInfoById(printerId: string): Promise<PrinterInfo>; 2506 2507 /** 2508 * Notify print service of application event. 2509 * @permission ohos.permission.MANAGE_PRINT_JOB 2510 * @param { ApplicationEvent } event - Indicates the event to be notified. 2511 * @returns { Promise<void> } the promise returned by the function. 2512 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2513 * @throws { BusinessError } 202 - not system application 2514 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2515 * @syscap SystemCapability.Print.PrintFramework 2516 * @systemapi Hide this for inner system use. 2517 * @since arkts {'1.1':'12','1.2':'20'} 2518 * @arkts 1.1&1.2 2519 */ 2520 function notifyPrintServiceEvent(event: ApplicationEvent): Promise<void>; 2521 2522 /** 2523 * New printers have been found and notify Print SA. 2524 * @permission ohos.permission.PRINT 2525 * @param { PrinterInformation } printerInformation - Indicates new arrived printer lists. 2526 * @returns { Promise<void> } the promise returned by the function. 2527 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2528 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2529 * @syscap SystemCapability.Print.PrintFramework 2530 * @since arkts {'1.1':'14','1.2':'20'} 2531 * @arkts 1.1&1.2 2532 */ 2533 function addPrinterToDiscovery(printerInformation: PrinterInformation): Promise<void>; 2534 2535 /** 2536 * Update the information of the specific printer. 2537 * @permission ohos.permission.PRINT 2538 * @param { PrinterInformation } printerInformation - Indicates to be updated printer lists. 2539 * @returns { Promise<void> } the promise returned by the function. 2540 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2541 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2542 * @syscap SystemCapability.Print.PrintFramework 2543 * @since arkts {'1.1':'14','1.2':'20'} 2544 * @arkts 1.1&1.2 2545 */ 2546 function updatePrinterInDiscovery(printerInformation: PrinterInformation): Promise<void>; 2547 2548 /** 2549 * Notify Print SA to remove printer. 2550 * @permission ohos.permission.PRINT 2551 * @param { string } printerId - Indicates the lost printer lists. 2552 * @returns { Promise<void> } the promise returned by the function. 2553 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2554 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2555 * @syscap SystemCapability.Print.PrintFramework 2556 * @since arkts {'1.1':'14','1.2':'20'} 2557 * @arkts 1.1&1.2 2558 */ 2559 function removePrinterFromDiscovery(printerId: string): Promise<void>; 2560 2561 /** 2562 * Get printerInformation by printer id. 2563 * @permission ohos.permission.PRINT 2564 * @param { string } printerId - Indicates id of the printer. 2565 * @returns { Promise<PrinterInformation> } the promise returned by the function. 2566 * @throws { BusinessError } 201 - the application does not have permission to call this function. 2567 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 2568 * @syscap SystemCapability.Print.PrintFramework 2569 * @since arkts {'1.1':'14','1.2':'20'} 2570 * @arkts 1.1&1.2 2571 */ 2572 function getPrinterInformationById(printerId: string): Promise<PrinterInformation>; 2573 2574 /** 2575 * defines printer information. 2576 * @typedef PrinterInformation 2577 * @syscap SystemCapability.Print.PrintFramework 2578 * @since arkts {'1.1':'14','1.2':'20'} 2579 * @arkts 1.1&1.2 2580 */ 2581 interface PrinterInformation { 2582 /** 2583 * Printer id. 2584 * @type { string } 2585 * @syscap SystemCapability.Print.PrintFramework 2586 * @since arkts {'1.1':'14','1.2':'20'} 2587 * @arkts 1.1&1.2 2588 */ 2589 printerId: string; 2590 2591 /** 2592 * Printer name. 2593 * @type { string } 2594 * @syscap SystemCapability.Print.PrintFramework 2595 * @since arkts {'1.1':'14','1.2':'20'} 2596 * @arkts 1.1&1.2 2597 */ 2598 printerName: string; 2599 2600 /** 2601 * Current printer status. 2602 * @type { PrinterStatus } 2603 * @syscap SystemCapability.Print.PrintFramework 2604 * @since arkts {'1.1':'14','1.2':'20'} 2605 * @arkts 1.1&1.2 2606 */ 2607 printerStatus: PrinterStatus; 2608 2609 /** 2610 * Printer description. 2611 * @type { ?string } 2612 * @syscap SystemCapability.Print.PrintFramework 2613 * @since arkts {'1.1':'14','1.2':'20'} 2614 * @arkts 1.1&1.2 2615 */ 2616 description?: string; 2617 2618 /** 2619 * Printer capabilities. 2620 * @type { ?PrinterCapabilities } 2621 * @syscap SystemCapability.Print.PrintFramework 2622 * @since arkts {'1.1':'14','1.2':'20'} 2623 * @arkts 1.1&1.2 2624 */ 2625 capability?: PrinterCapabilities; 2626 2627 /** 2628 * Printer uri. 2629 * @type { ?string } 2630 * @syscap SystemCapability.Print.PrintFramework 2631 * @since arkts {'1.1':'14','1.2':'20'} 2632 * @arkts 1.1&1.2 2633 */ 2634 uri?: string; 2635 2636 /** 2637 * Printer make. 2638 * @type { ?string } 2639 * @syscap SystemCapability.Print.PrintFramework 2640 * @since arkts {'1.1':'14','1.2':'20'} 2641 * @arkts 1.1&1.2 2642 */ 2643 printerMake?: string; 2644 2645 /** 2646 * Printer preferences. 2647 * @type { ?PrinterPreferences } 2648 * @syscap SystemCapability.Print.PrintFramework 2649 * @since arkts {'1.1':'18','1.2':'20'} 2650 * @arkts 1.1&1.2 2651 */ 2652 preferences?: PrinterPreferences; 2653 2654 /** 2655 * Printer alias. 2656 * @type { ?string } 2657 * @syscap SystemCapability.Print.PrintFramework 2658 * @since arkts {'1.1':'18','1.2':'20'} 2659 * @arkts 1.1&1.2 2660 */ 2661 alias?: string; 2662 2663 /** 2664 * Detail information in json format. 2665 * @type { ?string } 2666 * @syscap SystemCapability.Print.PrintFramework 2667 * @since arkts {'1.1':'14','1.2':'20'} 2668 * @arkts 1.1&1.2 2669 */ 2670 options?: string; 2671 } 2672 2673 /** 2674 * defines printer capabilities. 2675 * @typedef PrinterCapabilities 2676 * @syscap SystemCapability.Print.PrintFramework 2677 * @since arkts {'1.1':'14','1.2':'20'} 2678 * @arkts 1.1&1.2 2679 */ 2680 interface PrinterCapabilities { 2681 /** 2682 * The page size list supported by the printer. 2683 * @type { Array<PrintPageSize> } 2684 * @syscap SystemCapability.Print.PrintFramework 2685 * @since arkts {'1.1':'14','1.2':'20'} 2686 * @arkts 1.1&1.2 2687 */ 2688 supportedPageSizes: Array<PrintPageSize>; 2689 2690 /** 2691 * Array of supported color mode. 2692 * @type { Array<PrintColorMode> } 2693 * @syscap SystemCapability.Print.PrintFramework 2694 * @since arkts {'1.1':'14','1.2':'20'} 2695 * @arkts 1.1&1.2 2696 */ 2697 supportedColorModes: Array<PrintColorMode>; 2698 2699 /** 2700 * Array of supported duplex mode. 2701 * @type { Array<PrintDuplexMode> } 2702 * @syscap SystemCapability.Print.PrintFramework 2703 * @since arkts {'1.1':'14','1.2':'20'} 2704 * @arkts 1.1&1.2 2705 */ 2706 supportedDuplexModes: Array<PrintDuplexMode>; 2707 2708 /** 2709 * Array of supported print media types. 2710 * @type { ?Array<string> } 2711 * @syscap SystemCapability.Print.PrintFramework 2712 * @since arkts {'1.1':'14','1.2':'20'} 2713 * @arkts 1.1&1.2 2714 */ 2715 supportedMediaTypes?: Array<string>; 2716 2717 /** 2718 * Array of supported print quality. 2719 * @type { ?Array<PrintQuality> } 2720 * @syscap SystemCapability.Print.PrintFramework 2721 * @since arkts {'1.1':'14','1.2':'20'} 2722 * @arkts 1.1&1.2 2723 */ 2724 supportedQualities?: Array<PrintQuality>; 2725 2726 /** 2727 * Array of supported print orientation. 2728 * @type { ?Array<PrintOrientationMode> } 2729 * @syscap SystemCapability.Print.PrintFramework 2730 * @since arkts {'1.1':'14','1.2':'20'} 2731 * @arkts 1.1&1.2 2732 */ 2733 supportedOrientations?: Array<PrintOrientationMode>; 2734 2735 /** 2736 * Advanced capability in json format. 2737 * @type { ?string } 2738 * @syscap SystemCapability.Print.PrintFramework 2739 * @since arkts {'1.1':'14','1.2':'20'} 2740 * @arkts 1.1&1.2 2741 */ 2742 options?: string; 2743 } 2744 2745 /** 2746 * Enumeration of Print Quality. 2747 * @enum { int } PrintQuality 2748 * @syscap SystemCapability.Print.PrintFramework 2749 * @since arkts {'1.1':'14','1.2':'20'} 2750 * @arkts 1.1&1.2 2751 */ 2752 enum PrintQuality { 2753 /** 2754 * Draft quality mode. 2755 * @syscap SystemCapability.Print.PrintFramework 2756 * @since arkts {'1.1':'14','1.2':'20'} 2757 * @arkts 1.1&1.2 2758 */ 2759 QUALITY_DRAFT = 3, 2760 2761 /** 2762 * Normal quality mode. 2763 * @syscap SystemCapability.Print.PrintFramework 2764 * @since arkts {'1.1':'14','1.2':'20'} 2765 * @arkts 1.1&1.2 2766 */ 2767 QUALITY_NORMAL = 4, 2768 2769 /** 2770 * High quality mode. 2771 * @syscap SystemCapability.Print.PrintFramework 2772 * @since arkts {'1.1':'14','1.2':'20'} 2773 * @arkts 1.1&1.2 2774 */ 2775 QUALITY_HIGH = 5, 2776 } 2777 2778 /** 2779 * Enumeration of Print OrientationMode. 2780 * @enum { int } PrintOrientationMode 2781 * @syscap SystemCapability.Print.PrintFramework 2782 * @since arkts {'1.1':'14','1.2':'20'} 2783 * @arkts 1.1&1.2 2784 */ 2785 enum PrintOrientationMode { 2786 /** 2787 * Portrait mode. 2788 * @syscap SystemCapability.Print.PrintFramework 2789 * @since arkts {'1.1':'14','1.2':'20'} 2790 * @arkts 1.1&1.2 2791 */ 2792 ORIENTATION_MODE_PORTRAIT = 0, 2793 2794 /** 2795 * Landscape mode. 2796 * @syscap SystemCapability.Print.PrintFramework 2797 * @since arkts {'1.1':'14','1.2':'20'} 2798 * @arkts 1.1&1.2 2799 */ 2800 ORIENTATION_MODE_LANDSCAPE= 1, 2801 2802 /** 2803 * Reverse landscape mode. 2804 * @syscap SystemCapability.Print.PrintFramework 2805 * @since arkts {'1.1':'14','1.2':'20'} 2806 * @arkts 1.1&1.2 2807 */ 2808 ORIENTATION_MODE_REVERSE_LANDSCAPE = 2, 2809 2810 /** 2811 * Reverse portrait mode. 2812 * @syscap SystemCapability.Print.PrintFramework 2813 * @since arkts {'1.1':'14','1.2':'20'} 2814 * @arkts 1.1&1.2 2815 */ 2816 ORIENTATION_MODE_REVERSE_PORTRAIT = 3, 2817 2818 /** 2819 * Not specified. 2820 * @syscap SystemCapability.Print.PrintFramework 2821 * @since arkts {'1.1':'14','1.2':'20'} 2822 * @arkts 1.1&1.2 2823 */ 2824 ORIENTATION_MODE_NONE = 4, 2825 } 2826 2827 /** 2828 * Enumeration of Printer Status. 2829 * @enum { int } PrinterStatus 2830 * @syscap SystemCapability.Print.PrintFramework 2831 * @since arkts {'1.1':'14','1.2':'20'} 2832 * @arkts 1.1&1.2 2833 */ 2834 enum PrinterStatus { 2835 /** 2836 * Printer idle. 2837 * @syscap SystemCapability.Print.PrintFramework 2838 * @since arkts {'1.1':'14','1.2':'20'} 2839 * @arkts 1.1&1.2 2840 */ 2841 PRINTER_IDLE = 0, 2842 2843 /** 2844 * Printer busy. 2845 * @syscap SystemCapability.Print.PrintFramework 2846 * @since arkts {'1.1':'14','1.2':'20'} 2847 * @arkts 1.1&1.2 2848 */ 2849 PRINTER_BUSY = 1, 2850 2851 /** 2852 * Printer not available. 2853 * @syscap SystemCapability.Print.PrintFramework 2854 * @since arkts {'1.1':'14','1.2':'20'} 2855 * @arkts 1.1&1.2 2856 */ 2857 PRINTER_UNAVAILABLE = 2, 2858 } 2859 2860 /** 2861 * defines printer preferences. 2862 * @typedef PrinterPreferences 2863 * @syscap SystemCapability.Print.PrintFramework 2864 * @since arkts {'1.1':'18','1.2':'20'} 2865 * @arkts 1.1&1.2 2866 */ 2867 interface PrinterPreferences { 2868 /** 2869 * Default duplex mode. 2870 * @type { ?PrintDuplexMode } 2871 * @syscap SystemCapability.Print.PrintFramework 2872 * @since arkts {'1.1':'18','1.2':'20'} 2873 * @arkts 1.1&1.2 2874 */ 2875 defaultDuplexMode?: PrintDuplexMode; 2876 2877 /** 2878 * Default quality. 2879 * @type { ?PrintQuality } 2880 * @syscap SystemCapability.Print.PrintFramework 2881 * @since arkts {'1.1':'18','1.2':'20'} 2882 * @arkts 1.1&1.2 2883 */ 2884 defaultPrintQuality?: PrintQuality; 2885 2886 /** 2887 * Default media type. 2888 * @type { ?string } 2889 * @syscap SystemCapability.Print.PrintFramework 2890 * @since arkts {'1.1':'18','1.2':'20'} 2891 * @arkts 1.1&1.2 2892 */ 2893 defaultMediaType?: string; 2894 2895 /** 2896 * Default page size id. 2897 * @type { ?string } 2898 * @syscap SystemCapability.Print.PrintFramework 2899 * @since arkts {'1.1':'18','1.2':'20'} 2900 * @arkts 1.1&1.2 2901 */ 2902 defaultPageSizeId?: string; 2903 2904 /** 2905 * Default orientation mode. 2906 * @type { ?PrintOrientationMode } 2907 * @syscap SystemCapability.Print.PrintFramework 2908 * @since arkts {'1.1':'18','1.2':'20'} 2909 * @arkts 1.1&1.2 2910 */ 2911 defaultOrientation?: PrintOrientationMode; 2912 2913 /** 2914 * Default margins. 2915 * @type { ?boolean } 2916 * @syscap SystemCapability.Print.PrintFramework 2917 * @since arkts {'1.1':'18','1.2':'20'} 2918 * @arkts 1.1&1.2 2919 */ 2920 borderless?: boolean; 2921 2922 /** 2923 * Detailed printer preferences in json format. 2924 * @type { ?string } 2925 * @syscap SystemCapability.Print.PrintFramework 2926 * @since arkts {'1.1':'18','1.2':'20'} 2927 * @arkts 1.1&1.2 2928 */ 2929 options?: string; 2930 } 2931 2932 /** 2933 * Enumeration of Printer Change Events. 2934 * @enum { int } PrinterEvent 2935 * @syscap SystemCapability.Print.PrintFramework 2936 * @since arkts {'1.1':'18','1.2':'20'} 2937 * @arkts 1.1&1.2 2938 */ 2939 enum PrinterEvent { 2940 /** 2941 * Printer added. 2942 * @syscap SystemCapability.Print.PrintFramework 2943 * @since arkts {'1.1':'18','1.2':'20'} 2944 * @arkts 1.1&1.2 2945 */ 2946 PRINTER_EVENT_ADDED = 0, 2947 2948 /** 2949 * Printer deleted. 2950 * @syscap SystemCapability.Print.PrintFramework 2951 * @since arkts {'1.1':'18','1.2':'20'} 2952 * @arkts 1.1&1.2 2953 */ 2954 PRINTER_EVENT_DELETED = 1, 2955 2956 /** 2957 * Printer state changed. 2958 * @syscap SystemCapability.Print.PrintFramework 2959 * @since arkts {'1.1':'18','1.2':'20'} 2960 * @arkts 1.1&1.2 2961 */ 2962 PRINTER_EVENT_STATE_CHANGED = 2, 2963 2964 /** 2965 * Printer info changed. 2966 * @syscap SystemCapability.Print.PrintFramework 2967 * @since arkts {'1.1':'18','1.2':'20'} 2968 * @arkts 1.1&1.2 2969 */ 2970 PRINTER_EVENT_INFO_CHANGED = 3, 2971 2972 /** 2973 * Printer preference changed. 2974 * @syscap SystemCapability.Print.PrintFramework 2975 * @since arkts {'1.1':'18','1.2':'20'} 2976 * @arkts 1.1&1.2 2977 */ 2978 PRINTER_EVENT_PREFERENCE_CHANGED = 4, 2979 2980 /** 2981 * Last used printer changed. 2982 * @syscap SystemCapability.Print.PrintFramework 2983 * @since arkts {'1.1':'18','1.2':'20'} 2984 * @arkts 1.1&1.2 2985 */ 2986 PRINTER_EVENT_LAST_USED_PRINTER_CHANGED = 5, 2987 } 2988 2989 /** 2990 * Enumeration of default printer type. 2991 * @enum { int } DefaultPrinterType 2992 * @syscap SystemCapability.Print.PrintFramework 2993 * @since arkts {'1.1':'18','1.2':'20'} 2994 * @arkts 1.1&1.2 2995 */ 2996 enum DefaultPrinterType { 2997 /** 2998 * Default printer set by user. 2999 * @syscap SystemCapability.Print.PrintFramework 3000 * @since arkts {'1.1':'18','1.2':'20'} 3001 * @arkts 1.1&1.2 3002 */ 3003 DEFAULT_PRINTER_TYPE_SET_BY_USER = 0, 3004 3005 /** 3006 * The last used printer is used as the default printer. 3007 * @syscap SystemCapability.Print.PrintFramework 3008 * @since arkts {'1.1':'18','1.2':'20'} 3009 * @arkts 1.1&1.2 3010 */ 3011 DEFAULT_PRINTER_TYPE_LAST_USED_PRINTER = 1, 3012 } 3013 3014 /** 3015 * Update the information of the specific added printer. 3016 * @permission ohos.permission.MANAGE_PRINT_JOB 3017 * @param { PrinterInformation } printerInformation - Indicates the printer to be updated. 3018 * @returns { Promise<void> } the promise returned by the function. 3019 * @throws { BusinessError } 201 - the application does not have permission to call this function. 3020 * @throws { BusinessError } 202 - not system application 3021 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 3022 * @syscap SystemCapability.Print.PrintFramework 3023 * @systemapi Hide this for inner system use. 3024 * @since arkts {'1.1':'18','1.2':'20'} 3025 * @arkts 1.1&1.2 3026 */ 3027 function updatePrinterInformation(printerInformation: PrinterInformation): Promise<void>; 3028 3029 /** 3030 * Save the preferences set by the user. 3031 * @permission ohos.permission.MANAGE_PRINT_JOB 3032 * @param { string } printerId - Indicates the printer to be updated. 3033 * @param { PrinterPreferences } printerPreferences - Indicates the printer preferences set by the user. 3034 * @returns { Promise<void> } the promise returned by the function. 3035 * @throws { BusinessError } 201 - the application does not have permission to call this function. 3036 * @throws { BusinessError } 202 - not system application 3037 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 3038 * @syscap SystemCapability.Print.PrintFramework 3039 * @systemapi Hide this for inner system use. 3040 * @since arkts {'1.1':'18','1.2':'20'} 3041 * @arkts 1.1&1.2 3042 */ 3043 function setPrinterPreferences(printerId: string, printerPreferences: PrinterPreferences): Promise<void>; 3044 3045 /** 3046 * Discover all usb printers. 3047 * @permission ohos.permission.MANAGE_PRINT_JOB 3048 * @returns { Promise<Array<PrinterInformation>> } the promise returned by the function. 3049 * @throws { BusinessError } 201 - the application does not have permission to call this function. 3050 * @throws { BusinessError } 202 - not system application 3051 * @syscap SystemCapability.Print.PrintFramework 3052 * @systemapi Hide this for inner system use. 3053 * @since arkts {'1.1':'18','1.2':'20'} 3054 * @arkts 1.1&1.2 3055 */ 3056 function discoverUsbPrinters(): Promise<Array<PrinterInformation>>; 3057 3058 /** 3059 * Save the default printer set by the user. 3060 * @permission ohos.permission.MANAGE_PRINT_JOB 3061 * @param { string } printerId - Indicates the printer to be set as the default printer. 3062 * @param { DefaultPrinterType } type - Indicates the default printer type. 3063 * @returns { Promise<void> } the promise returned by the function. 3064 * @throws { BusinessError } 201 - the application does not have permission to call this function. 3065 * @throws { BusinessError } 202 - not system application 3066 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 3067 * @syscap SystemCapability.Print.PrintFramework 3068 * @systemapi Hide this for inner system use. 3069 * @since arkts {'1.1':'18','1.2':'20'} 3070 * @arkts 1.1&1.2 3071 */ 3072 function setDefaultPrinter(printerId: string, type: DefaultPrinterType): Promise<void>; 3073 3074 /** 3075 * Notify print service of application event. 3076 * @permission ohos.permission.MANAGE_PRINT_JOB 3077 * @param { ApplicationEvent } event - Indicates the event to be notified. 3078 * @param { string } jobId - Indicates the job id. 3079 * @returns { Promise<void> } the promise returned by the function. 3080 * @throws { BusinessError } 201 - the application does not have permission to call this function. 3081 * @throws { BusinessError } 202 - not system application 3082 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 3083 * @syscap SystemCapability.Print.PrintFramework 3084 * @systemapi Hide this for inner system use. 3085 * @since arkts {'1.1':'18','1.2':'20'} 3086 * @arkts 1.1&1.2 3087 */ 3088 function notifyPrintServiceEvent(event: ApplicationEvent, jobId: string): Promise<void>; 3089 3090 /** 3091 * Defines the callback type used in registering to listen for PrinterEvent. 3092 * The value of event indicates the information of PrinterEvent. 3093 * The value of printerInformation indicates the latest printer information. 3094 * 3095 * @typedef { function } PrinterChangeCallback 3096 * @param { PrinterEvent } event - the information of PrinterEvent 3097 * @param { PrinterInformation } printerInformation - the information of the latest printer 3098 * @syscap SystemCapability.Print.PrintFramework 3099 * @since arkts {'1.1':'18','1.2':'20'} 3100 * @arkts 1.1&1.2 3101 */ 3102 type PrinterChangeCallback = (event: PrinterEvent, printerInformation: PrinterInformation) => void; 3103 3104 /** 3105 * Register event callback for the change of printer. 3106 * @permission ohos.permission.PRINT 3107 * @param { 'printerChange' } type - Indicates change of printer. 3108 * @param { PrinterChangeCallback } callback - The callback function for change of printer. 3109 * @throws { BusinessError } 201 - the application does not have permission to call this function. 3110 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 3111 * @syscap SystemCapability.Print.PrintFramework 3112 * @since arkts {'1.1':'18','1.2':'20'} 3113 * @arkts 1.1&1.2 3114 */ 3115 function on(type: 'printerChange', callback: PrinterChangeCallback): void; 3116 3117 /** 3118 * Unregister event callback for the change of printer. 3119 * @permission ohos.permission.PRINT 3120 * @param { 'printerChange' } type - Indicates change of printer. 3121 * @param { PrinterChangeCallback } [callback] - The callback function for change of printer. 3122 * @throws { BusinessError } 201 - the application does not have permission to call this function. 3123 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. 3124 * @syscap SystemCapability.Print.PrintFramework 3125 * @since arkts {'1.1':'18','1.2':'20'} 3126 * @arkts 1.1&1.2 3127 */ 3128 function off(type: 'printerChange', callback?: PrinterChangeCallback): void; 3129} 3130 3131export default print;