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 * class of print extensionAbility. 18 * 19 * @systemapi Hide this for inner system use. 20 * @since 9 21 * @syscap SystemCapability.Print.PrintFramework 22 * @StageModelOnly 23 */ 24import Want from './@ohos.application.Want'; 25import print from "./@ohos.print"; 26 27 28export default class PrintExtensionAbility { 29 30 /** 31 * Called once to initialize the extensionAbility. 32 * 33 * @systemapi Hide this for inner system use. 34 * @since 9 35 * @syscap SystemCapability.Print.PrintFramework 36 * @return - 37 * @StageModelOnly 38 */ 39 onCreate(want: Want): void; 40 41 /** 42 * Called once to start to discover the printers connected with the device. 43 * 44 * @systemapi Hide this for inner system use. 45 * @since 9 46 * @syscap SystemCapability.Print.PrintFramework 47 * @return - 48 * @StageModelOnly 49 */ 50 onStartDiscoverPrinter(): void; 51 52 /** 53 * Called once to stop discovering the printer. 54 * 55 * @systemapi Hide this for inner system use. 56 * @since 9 57 * @syscap SystemCapability.Print.PrintFramework 58 * @return - 59 * @StageModelOnly 60 */ 61 onStopDiscoverPrinter(): void; 62 63 /** 64 * Called once to connect to the specific printer. 65 * 66 * @systemapi Hide this for inner system use. 67 * @since 9 68 * @syscap SystemCapability.Print.PrintFramework 69 * @return - 70 * @StageModelOnly 71 */ 72 onConnectPrinter(printerId: number): void; 73 74 /** 75 * Called once to disconnect the specific printer. 76 * 77 * @systemapi Hide this for inner system use. 78 * @since 9 79 * @syscap SystemCapability.Print.PrintFramework 80 * @return - 81 * @StageModelOnly 82 */ 83 onDisconnectPrinter(printerId: number): void; 84 85 /** 86 * Called once to start print job. 87 * 88 * @systemapi Hide this for inner system use. 89 * @since 9 90 * @syscap SystemCapability.Print.PrintFramework 91 * @return - 92 * @StageModelOnly 93 */ 94 onStartPrintJob(jobInfo: print.PrintJob): void; 95 96 /** 97 * Called once to remove the print job has been started. 98 * 99 * @systemapi Hide this for inner system use. 100 * @since 9 101 * @syscap SystemCapability.Print.PrintFramework 102 * @return - 103 * @StageModelOnly 104 */ 105 onCancelPrintJob(jobInfo: print.PrintJob): void; 106 107 /** 108 * Called once to request the capability of the printer. 109 * 110 * @systemapi Hide this for inner system use. 111 * @since 9 112 * @syscap SystemCapability.Print.PrintFramework 113 * @return - 114 * @StageModelOnly 115 */ 116 onRequestPrinterCapability(printerId: number): print.PrinterCapability; 117 118 /** 119 * Called once to request preview and send result to Print SA. 120 * 121 * @systemapi Hide this for inner system use. 122 * @since 9 123 * @syscap SystemCapability.Print.PrintFramework 124 * @return - 125 * @StageModelOnly 126 */ 127 onRequestPreview(jobInfo: print.PrintJob): string; 128 129 /** 130 * Called once to finalize the extensionAbility. 131 * 132 * @systemapi Hide this for inner system use. 133 * @since 9 134 * @syscap SystemCapability.Print.PrintFramework 135 * @return - 136 * @StageModelOnly 137 */ 138 onDestroy(): void; 139}