• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 Want from './@ohos.app.ability.Want';
22import type print from './@ohos.print';
23
24/**
25 * class of print extensionAbility.
26 *
27 * @syscap SystemCapability.Print.PrintFramework
28 * @stagemodelonly
29 * @since arkts {'1.1':'14','1.2':'20'}
30 * @arkts 1.1&1.2
31 */
32declare class PrintExtensionAbility {
33
34  /**
35   * Called once to initialize the extensionAbility.
36   * @param { Want } want - call print page want params.
37   * @syscap SystemCapability.Print.PrintFramework
38   * @stagemodelonly
39   * @since arkts {'1.1':'14','1.2':'20'}
40   * @arkts 1.1&1.2
41   */
42  onCreate(want: Want): void;
43
44  /**
45   * Called once to start to discover the printers connected with the device.
46   * @syscap SystemCapability.Print.PrintFramework
47   * @stagemodelonly
48   * @since arkts {'1.1':'14','1.2':'20'}
49   * @arkts 1.1&1.2
50   */
51  onStartDiscoverPrinter(): void;
52
53  /**
54   * Called once to stop discovering the printer.
55   * @syscap SystemCapability.Print.PrintFramework
56   * @stagemodelonly
57   * @since arkts {'1.1':'14','1.2':'20'}
58   * @arkts 1.1&1.2
59   */
60  onStopDiscoverPrinter(): void;
61
62  /**
63   * Called once to connect to the specific printer.
64   * @param { number } printerId - connect the printerId.
65   * @syscap SystemCapability.Print.PrintFramework
66   * @stagemodelonly
67   * @since arkts {'1.1':'14','1.2':'20'}
68   * @arkts 1.1&1.2
69   */
70  onConnectPrinter(printerId: number): void;
71
72  /**
73   * Called once to disconnect to the specific printer.
74   * @param { number } printerId - connect the printerId.
75   * @syscap SystemCapability.Print.PrintFramework
76   * @stagemodelonly
77   * @since arkts {'1.1':'14','1.2':'20'}
78   * @arkts 1.1&1.2
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 arkts {'1.1':'10','1.2':'20'}
90   * @arkts 1.1&1.2
91   */
92  onStartPrintJob(jobInfo: print.PrintJob): void;
93
94  /**
95   * Called once to remove the print job has been started.
96   * @param { print.PrintJob } jobInfo - Indicates the information of print job.
97   * @throws { BusinessError } 202 - not system application
98   * @syscap SystemCapability.Print.PrintFramework
99   * @systemapi Hide this for inner system use.
100   * @stagemodelonly
101   * @since arkts {'1.1':'10','1.2':'20'}
102   * @arkts 1.1&1.2
103   */
104  onCancelPrintJob(jobInfo: print.PrintJob): void;
105
106  /**
107   * Called once to request the capability of the printer.
108   * @param { number } printerId - Indicates the information of printer.
109   * @returns { print.PrinterCapability } printer capability.
110   * @throws { BusinessError } 202 - not system application
111   * @syscap SystemCapability.Print.PrintFramework
112   * @systemapi Hide this for inner system use.
113   * @stagemodelonly
114   * @since arkts {'1.1':'10','1.2':'20'}
115   * @arkts 1.1&1.2
116   */
117  onRequestPrinterCapability(printerId: number): print.PrinterCapability;
118
119  /**
120   * Called once to request preview and send result to Print SA.
121   * @param {  print.PrintJob } jobInfo - Indicates the information of job.
122   * @returns { string} preview result.
123   * @throws { BusinessError } 202 - not system application
124   * @syscap SystemCapability.Print.PrintFramework
125   * @systemapi Hide this for inner system use.
126   * @stagemodelonly
127   * @since arkts {'1.1':'10','1.2':'20'}
128   * @arkts 1.1&1.2
129   */
130  onRequestPreview(jobInfo: print.PrintJob): string;
131
132  /**
133   * Called once to finalize the extensionAbility.
134   * @syscap SystemCapability.Print.PrintFramework
135   * @stagemodelonly
136   * @since arkts {'1.1':'14','1.2':'20'}
137   * @arkts 1.1&1.2
138   */
139  onDestroy(): void;
140}
141
142export default PrintExtensionAbility;