1/* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import type Want from './@ohos.application.Want'; 17import type print from './@ohos.print'; 18 19/** 20 * class of print extensionAbility. 21 * 22 * @systemapi Hide this for inner system use. 23 * @syscap SystemCapability.Print.PrintFramework 24 * @StageModelOnly 25 * @since 10 26 */ 27export default class PrintExtensionAbility { 28 29 /** 30 * Called once to initialize the extensionAbility. 31 * @param { Want } want - call print page want params. 32 * @throws { BusinessError } 202 - not system application 33 * @syscap SystemCapability.Print.PrintFramework 34 * @systemapi Hide this for inner system use. 35 * @StageModelOnly 36 * @since 10 37 */ 38 onCreate(want: Want): void; 39 40 /** 41 * Called once to start to discover the printers connected with the device. 42 * @throws { BusinessError } 202 - not system application 43 * @syscap SystemCapability.Print.PrintFramework 44 * @systemapi Hide this for inner system use. 45 * @StageModelOnly 46 * @since 10 47 */ 48 onStartDiscoverPrinter(): void; 49 50 /** 51 * Called once to stop discovering the printer. 52 * @throws { BusinessError } 202 - not system application 53 * @syscap SystemCapability.Print.PrintFramework 54 * @systemapi Hide this for inner system use. 55 * @StageModelOnly 56 * @since 10 57 */ 58 onStopDiscoverPrinter(): void; 59 60 /** 61 * Called once to connect to the specific printer. 62 * @param { number } printerId - connect the printerId. 63 * @throws { BusinessError } 202 - not system application 64 * @syscap SystemCapability.Print.PrintFramework 65 * @systemapi Hide this for inner system use. 66 * @StageModelOnly 67 * @since 10 68 */ 69 onConnectPrinter(printerId: number): void; 70 71 /** 72 * Called once to disconnect to the specific printer. 73 * @param { number } printerId - connect the printerId. 74 * @throws { BusinessError } 202 - not system application 75 * @syscap SystemCapability.Print.PrintFramework 76 * @systemapi Hide this for inner system use. 77 * @StageModelOnly 78 * @since 10 79 */ 80 onDisconnectPrinter(printerId: number): void; 81 82 /** 83 * Called once to start print job. 84 * @param { print.PrintJob } jobInfo - Indicates the information of print job. 85 * @throws { BusinessError } 202 - not system application 86 * @syscap SystemCapability.Print.PrintFramework 87 * @systemapi Hide this for inner system use. 88 * @StageModelOnly 89 * @since 10 90 */ 91 onStartPrintJob(jobInfo: print.PrintJob): void; 92 93 /** 94 * Called once to remove the print job has been started. 95 * @param { print.PrintJob } jobInfo - Indicates the information of print job. 96 * @throws { BusinessError } 202 - not system application 97 * @syscap SystemCapability.Print.PrintFramework 98 * @systemapi Hide this for inner system use. 99 * @StageModelOnly 100 * @since 10 101 */ 102 onCancelPrintJob(jobInfo: print.PrintJob): void; 103 104 /** 105 * Called once to request the capability of the printer. 106 * @param { number } printerId - Indicates the information of printer. 107 * @returns { print.PrinterCapability } printer capability. 108 * @throws { BusinessError } 202 - not system application 109 * @syscap SystemCapability.Print.PrintFramework 110 * @systemapi Hide this for inner system use. 111 * @StageModelOnly 112 * @since 10 113 */ 114 onRequestPrinterCapability(printerId: number): print.PrinterCapability; 115 116 /** 117 * Called once to request preview and send result to Print SA. 118 * @param { print.PrintJob } jobInfo - Indicates the information of job. 119 * @returns { string} preview result. 120 * @throws { BusinessError } 202 - not system application 121 * @syscap SystemCapability.Print.PrintFramework 122 * @systemapi Hide this for inner system use. 123 * @StageModelOnly 124 * @since 10 125 */ 126 onRequestPreview(jobInfo: print.PrintJob): string; 127 128 /** 129 * Called once to finalize the extensionAbility. 130 * @throws { BusinessError } 202 - not system application 131 * @syscap SystemCapability.Print.PrintFramework 132 * @systemapi Hide this for inner system use. 133 * @StageModelOnly 134 * @since 10 135 */ 136 onDestroy(): void; 137} 138