/* * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import type { AsyncCallback, Callback } from './@ohos.base'; /** * System print * * @namespace print * @syscap SystemCapability.Print.PrintFramework * @since 10 */ declare namespace print { /** * PrintTask provide event callback. * @interface PrintTask * @syscap SystemCapability.Print.PrintFramework * @since 10 */ interface PrintTask { /** * Register event callback when the current print task is in process. * @permission ohos.permission.PRINT * @param { 'block' } type - Indicates the print task has been blocked. * @param { Callback } callback - The callback function for print task change event * @throws { BusinessError } 201 - the application does not have permission to call this function. * @syscap SystemCapability.Print.PrintFramework * @since 10 */ on(type: 'block', callback: Callback): void; /** * Register event callback when the current print task is in process. * @permission ohos.permission.PRINT * @param { 'succeed' } type - Indicates the print task succeed. * @param { Callback } callback - The callback function for print task change event * @throws { BusinessError } 201 - the application does not have permission to call this function. * @syscap SystemCapability.Print.PrintFramework * @since 10 */ on(type: 'succeed', callback: Callback): void; /** * Register event callback when the current print task is in process. * @permission ohos.permission.PRINT * @param { 'fail' } type - Indicates the print task has completed with failure. * @param { Callback } callback - The callback function for print task change event * @throws { BusinessError } 201 - the application does not have permission to call this function. * @syscap SystemCapability.Print.PrintFramework * @since 10 */ on(type: 'fail', callback: Callback): void; /** * Register event callback when the current print task is in process. * @permission ohos.permission.PRINT * @param { 'cancel' } type - Indicates the print task has been cancelled. * @param { Callback } callback - The callback function for print task change event * @throws { BusinessError } 201 - the application does not have permission to call this function. * @syscap SystemCapability.Print.PrintFramework * @since 10 */ on(type: 'cancel', callback: Callback): void; /** * Unregister event callback when the current print task is in process. * @permission ohos.permission.PRINT * @param { 'block' } type - Indicates the print task has been blocked. * @param { Callback } callback - The callback function for print task change event * @throws { BusinessError } 201 - the application does not have permission to call this function. * @syscap SystemCapability.Print.PrintFramework * @since 10 */ off(type: 'block', callback?: Callback): void; /** * Unregister event callback when the current print task is in process. * @permission ohos.permission.PRINT * @param { 'succeed' } type - Indicates the print task succeed. * @param { Callback } callback - The callback function for print task change event * @throws { BusinessError } 201 - the application does not have permission to call this function. * @syscap SystemCapability.Print.PrintFramework * @since 10 */ off(type: 'succeed', callback?: Callback): void; /** * Unregister event callback when the current print task is in process. * @permission ohos.permission.PRINT * @param { 'fail' } type - Indicates the print task has completed with failure. * @param { Callback } callback - The callback function for print task change event * @throws { BusinessError } 201 - the application does not have permission to call this function. * @syscap SystemCapability.Print.PrintFramework * @since 10 */ off(type: 'fail', callback?: Callback): void; /** * Unregister event callback when the current print task is in process. * @permission ohos.permission.PRINT * @param { 'cancel' } type - Indicates the print task has been cancelled. * @param { Callback } callback - The callback function for print task change event * @throws { BusinessError } 201 - the application does not have permission to call this function. * @syscap SystemCapability.Print.PrintFramework * @since 10 */ off(type: 'cancel', callback?: Callback): void; } /** * Start new print task for App. * @permission ohos.permission.PRINT * @param { Array } files - Indicates the filepath list to be printed. Only pdf and picture filetype are supported. * @param { AsyncCallback } callback - The callback function for print task. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @syscap SystemCapability.Print.PrintFramework * @since 10 */ function print(files: Array, callback: AsyncCallback): void; /** * Start new print task for App. * @permission ohos.permission.PRINT * @param { Array } files - Indicates the filepath list to be printed. Only pdf and picture filetype are supported. * @returns { Promise } the promise returned by the function. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @syscap SystemCapability.Print.PrintFramework * @since 10 */ function print(files: Array): Promise; /** * defines print margin. * @typedef PrintMargin * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ interface PrintMargin { /** * Top margin. * @type { ?number } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ top?: number; /** * Bottom margin. * @type { ?number } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ bottom?: number; /** * Left margin. * @type { ?number } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ left?: number; /** * Right margin. * @type { ?number } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ right?: number; } /** * defines print range. * @typedef PrinterRange * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ interface PrinterRange { /** * Start page of sequence. * @type { ?number } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ startPage?: number; /** * End page of sequence. * @type { ?number } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ endPage?: number; /** * Discrete page of sequence. * @type { ?Array } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ pages?: Array; } /** * defines print preview attribute. * @typedef PreviewAttribute * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ interface PreviewAttribute { /** * Preview page range. * @type { PrinterRange } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ previewRange: PrinterRange; /** * Preview file result. * @type { ?number } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ result?: number; } /** * defines print resolution. * @typedef PrintResolution * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ interface PrintResolution { /** * Resolution id. * @type { string } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ id: string; /** * Horizontal DPI. * @type { number } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ horizontalDpi: number; /** * Vertical DPI. * @type { number } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ verticalDpi: number; } /** * defines print page size. * @typedef PrintPageSize * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ interface PrintPageSize { /** * Page size id. * @type { string } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ id: string; /** * Page size name. * @type { string } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ name: string; /** * Unit: millimeter width. * @type { number } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ width: number; /** * Unit: millimeter height. * @type { number } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ height: number; } /** * defines print capability. * @typedef PrinterCapability * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ interface PrinterCapability { /** * Color mode. * @type { number } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ colorMode: number; /** * Duplex mode. * @type { number } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ duplexMode: number; /** * The page size list supported by the printer. * @type { Array } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ pageSize: Array; /** * The resolution list supported by the printer. * @type { ?Array } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ resolution?: Array; /** * Min margin of printer. * @type { ?PrintMargin } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ minMargin?: PrintMargin; } /** * defines print info. * @typedef PrinterInfo * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ interface PrinterInfo { /** * Printer id. * @type { string } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ printerId: string; /** * Printer name. * @type { string } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ printerName: string; /** * Current printer state. * @type { PrinterState } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ printerState: PrinterState; /** * Resource id of printer icon. * @type { ?number } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ printerIcon?: number; /** * Printer description. * @type { ?string } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ description?: string; /** * Printer capability. * @type { ?PrinterCapability } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ capability?: PrinterCapability; /** * JSON object string. * @type { ?Object } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ options? :Object; } /** * defines print job. * @typedef PrintJob * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ interface PrintJob { /** * Document fd list to be printed. * @type { Array } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ fdList: Array; /** * Job id. * @type { string } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ jobId: string; /** * Printer id to take charge of printing. * @type { string } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ printerId: string; /** * Current print job state. * @type { PrintJobState } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ jobState: PrintJobState; /** * Copies of document list. * @type { number } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ copyNumber: number; /** * Range size to be printed. * @type { PrinterRange } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ pageRange: PrinterRange; /** * Sequential print. * @type { boolean } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ isSequential: boolean; /** * The selected page size. * @type { PrintPageSize } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ pageSize: PrintPageSize; /** * Vertical printing. * @type { boolean } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ isLandscape: boolean; /** * Color mode. * @type { number } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ colorMode: number; /** * Duplex mode. * @type { number } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ duplexMode: number; /** * Current margin setting. * @type { ?PrintMargin } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ margin?: PrintMargin; /** * Preview setting. * @type { ?PreviewAttribute } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ preview?: PreviewAttribute; /** * JSON object string. * @type { ?Object } * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ options? :Object; } /** * Enumeration of Printer State. * @enum { number } PrinterState * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ enum PrinterState { /** * New printers arrival. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ PRINTER_ADDED = 0, /** * Printer lost. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ PRINTER_REMOVED = 1, /** * Printer update. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ PRINTER_CAPABILITY_UPDATED = 2, /** * Printer has been connected. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ PRINTER_CONNECTED = 3, /** * Printer has been disconnected. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ PRINTER_DISCONNECTED = 4, /** * Printer is working. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ PRINTER_RUNNING = 5, } /** * Enumeration of Print Job State. * @enum { number } PrintJobState * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ enum PrintJobState { /** * Initial state of print job. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ PRINT_JOB_PREPARE = 0, /** * Deliver print job to the printer. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ PRINT_JOB_QUEUED = 1, /** * Executing print job. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ PRINT_JOB_RUNNING = 2, /** * Print job has been blocked. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ PRINT_JOB_BLOCKED = 3, /** * Print job completed. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ PRINT_JOB_COMPLETED = 4, } /** * Enumeration of Print Job Sub State. * @enum { number } PrintJobSubState * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ enum PrintJobSubState { /** * Print job succeed. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ PRINT_JOB_COMPLETED_SUCCESS = 0, /** * Print job fail. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ PRINT_JOB_COMPLETED_FAILED = 1, /** * Print job has been cancelled. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ PRINT_JOB_COMPLETED_CANCELLED = 2, /** * Print job has been corrupted. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ PRINT_JOB_COMPLETED_FILE_CORRUPTED = 3, /** * Print is offline. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ PRINT_JOB_BLOCK_OFFLINE = 4, /** * Print is occupied by other process. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ PRINT_JOB_BLOCK_BUSY = 5, /** * Print job has been cancelled. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ PRINT_JOB_BLOCK_CANCELLED = 6, /** * Print out of paper. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ PRINT_JOB_BLOCK_OUT_OF_PAPER = 7, /** * Print out of ink. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ PRINT_JOB_BLOCK_OUT_OF_INK = 8, /** * Print out of toner. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ PRINT_JOB_BLOCK_OUT_OF_TONER = 9, /** * Print paper jam. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ PRINT_JOB_BLOCK_JAMMED = 10, /** * Print cover open. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ PRINT_JOB_BLOCK_DOOR_OPEN = 11, /** * Print service request. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ PRINT_JOB_BLOCK_SERVICE_REQUEST = 12, /** * Print low on ink. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ PRINT_JOB_BLOCK_LOW_ON_INK = 13, /** * Print low on toner. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ PRINT_JOB_BLOCK_LOW_ON_TONER = 14, /** * Print really low on ink. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ PRINT_JOB_BLOCK_REALLY_LOW_ON_INK = 15, /** * Print bad certification. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ PRINT_JOB_BLOCK_BAD_CERTIFICATE = 16, /** * Print unknown issue. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ PRINT_JOB_BLOCK_UNKNOWN = 99, } /** * Enumeration of Print error Code. * @enum { number } PrintErrorCode * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ enum PrintErrorCode { /** * No error. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ E_PRINT_NONE = 0, /** * No permission. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ E_PRINT_NO_PERMISSION = 201, /** * Invalid parameter. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ E_PRINT_INVALID_PARAMETER = 401, /** * Generic failure of print. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ E_PRINT_GENERIC_FAILURE = 13100001, /** * RPC failure. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ E_PRINT_RPC_FAILURE = 13100002, /** * Failure of print service. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ E_PRINT_SERVER_FAILURE = 13100003, /** * Invalid print extension. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ E_PRINT_INVALID_EXTENSION = 13100004, /** * Invalid printer. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ E_PRINT_INVALID_PRINTER = 13100005, /** * Invalid print job. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ E_PRINT_INVALID_PRINT_JOB = 13100006, /** * File i/o error. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ E_PRINT_FILE_IO = 13100007, } /** * defines print ExtensionInfo. * @typedef PrinterExtensionInfo * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ interface PrinterExtensionInfo { /** * Extension id of printer extension. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ extensionId: string; /** * Vendor id of extension. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ vendorId: string; /** * Vendor name. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ vendorName: string; /** * Vendor icon. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ vendorIcon: number; /** * Version of current printer extension. * @syscap SystemCapability.Print.PrintFramework * @systemapi * @since 10 */ version: string; } /** * Get all printer extension installed. * @permission ohos.permission.MANAGE_PRINT_JOB * @param { AsyncCallback> } callback - The callback function for handling the extension list found. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function queryAllPrinterExtensionInfos(callback: AsyncCallback>): void; /** * Get all printer extension installed. * @permission ohos.permission.MANAGE_PRINT_JOB * @returns { Promise> } the promise returned by the function. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function queryAllPrinterExtensionInfos(): Promise>; /** * Load the specific printer extension and start to discover printer. * @permission ohos.permission.MANAGE_PRINT_JOB * @param { Array } extensionList - Indicates the list of printer extension. * empty list of extensionList Indicates to find printer with all installed extension. * @param { AsyncCallback } callback - The callback function for indcating the result of API execution. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function startDiscoverPrinter(extensionList: Array, callback: AsyncCallback): void; /** * Load the specific printer extension and start to discover printer. * @permission ohos.permission.MANAGE_PRINT_JOB * @param { Array } extensionList - Indicates the list of printer extension. * empty list of extensionList Indicates to find printer with all installed extension. * @returns { Promise } the promise returned by the function. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function startDiscoverPrinter(extensionList: Array): Promise; /** * Stop discovering the printer with specific printer extension. * @permission ohos.permission.MANAGE_PRINT_JOB * @param { AsyncCallback } callback - The callback function for indcating the result of API execution. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function stopDiscoverPrinter(callback: AsyncCallback): void; /** * Stop discovering the printer with specific printer extension. * @permission ohos.permission.MANAGE_PRINT_JOB * @returns { Promise } the promise returned by the function. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function stopDiscoverPrinter(): Promise; /** * Connect the specific printer. * @permission ohos.permission.MANAGE_PRINT_JOB * @param { string } printerId - Indicates id of the printer. * @param { AsyncCallback } callback - The callback function for indcating the result of API execution. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function connectPrinter(printerId: string, callback: AsyncCallback): void; /** * Connect the specific printer. * @permission ohos.permission.MANAGE_PRINT_JOB * @param { string } printerId - Indicates id of the printer. * @returns { Promise } the promise returned by the function. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function connectPrinter(printerId: string): Promise; /** * Disconnect the specific printer. * @permission ohos.permission.MANAGE_PRINT_JOB * @param { string } printerId - Indicates id of the printer. * @param { AsyncCallback } callback - The callback function for indcating the result of API execution. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function disconnectPrinter(printerId: string, callback: AsyncCallback): void; /** * Disconnect the specific printer. * @permission ohos.permission.MANAGE_PRINT_JOB * @param { string } printerId - Indicates id of the printer. * @returns { Promise } the promise returned by the function. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function disconnectPrinter(printerId: string): Promise; /** * Query capability for the specific printer. * @permission ohos.permission.MANAGE_PRINT_JOB * @param { string } printerId - Indicates id of the printer. * @param { AsyncCallback } callback - The callback function for capability from printer. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function queryPrinterCapability(printerId: string, callback: AsyncCallback): void; /** * Query capability for the specific printer. * @permission ohos.permission.MANAGE_PRINT_JOB * @param { string } printerId - Indicates id of the printer. * @returns { Promise } the promise returned by the function. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function queryPrinterCapability(printerId: string): Promise; /** * Start print job. * @permission ohos.permission.MANAGE_PRINT_JOB * @param { PrintJob } jobInfo - Indicates the information of print job. * @param { AsyncCallback } callback - The callback function for indcating the result of API execution. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function startPrintJob(jobInfo: PrintJob, callback: AsyncCallback): void; /** * Start print job. * @permission ohos.permission.MANAGE_PRINT_JOB * @param { PrintJob } jobInfo - Indicates the information of print job. * @returns { Promise } the promise returned by the function. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function startPrintJob(jobInfo: PrintJob): Promise; /** * Cancel the print job has been sent to printer. * @permission ohos.permission.MANAGE_PRINT_JOB * @param { string } jobId - Indicates the specific print job. * @param { AsyncCallback } callback - The callback function for indcating the result of API execution. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function cancelPrintJob(jobId: string, callback: AsyncCallback): void; /** * Cancel the print job has been sent to printer. * @permission ohos.permission.MANAGE_PRINT_JOB * @param { string } jobId - Indicates the specific print job. * @returns { Promise } the promise returned by the function. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function cancelPrintJob(jobId: string): Promise; /** * Request preview of the print job. * @permission ohos.permission.MANAGE_PRINT_JOB * @param { PrintJob } jobInfo - Indicates the information of print job. * @param { Callback } callback - The callback function for indcating the result of API execution. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function requestPrintPreview(jobInfo: PrintJob, callback: Callback): void; /** * Request preview of the print job. * @permission ohos.permission.MANAGE_PRINT_JOB * @param { PrintJob } jobInfo - Indicates the information of print job. * @returns { Promise } the promise returned by the function. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function requestPrintPreview(jobInfo: PrintJob): Promise; /** * Register event callback for the state change of printer. * @permission ohos.permission.MANAGE_PRINT_JOB * @param { 'printerStateChange' } type - Indicates state change of printer. * @param { function } callback - The callback function for state change of printer. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function on(type: 'printerStateChange', callback: (state: PrinterState, info: PrinterInfo) => void): void; /** * Unregister event callback for the state change of printer. * @permission ohos.permission.MANAGE_PRINT_JOB * @param { 'printerStateChange' } type - Indicates state change of printer. * @param { Callback } callback - The callback function for state change of printer. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function off(type: 'printerStateChange', callback?: Callback): void; /** * Register event callback for the state change of print job. * @permission ohos.permission.MANAGE_PRINT_JOB * @param { 'jobStateChange' } type - Indicates state change of printer. * @param { function } callback - The callback function for state change of printer. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function on(type: 'jobStateChange', callback: (state: PrintJobState, job: PrintJob) => void): void; /** * Unregister event callback for the state change of print job. * @permission ohos.permission.MANAGE_PRINT_JOB * @param { 'jobStateChange' } type - Indicates state change of printer. * @param { Callback } callback - The callback function for state change of printer. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function off(type: 'jobStateChange', callback?: Callback): void; /** * Register event callback for the information change of print extension. * @permission ohos.permission.MANAGE_PRINT_JOB * @param { 'extInfoChange' } type - Indicates information change of print extension. * @param { function } callback - The callback function for information change of print extension. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function on(type: 'extInfoChange', callback: (extensionId: string, info: string) => void): void; /** * Unregister event callback for the information change of print extension. * @permission ohos.permission.MANAGE_PRINT_JOB * @param { 'extInfoChange' } type - Indicates state change of printer. * @param { Callback } callback - The callback function for state change of printer. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function off(type: 'extInfoChange', callback?: Callback): void; /** * New printers have been found and notify Print SA. * @permission ohos.permission.MANAGE_PRINT_JOB * @param { Array } printers - Indicates new arrived printer lists. * @param { AsyncCallback } callback - The callback function for indcating the result of API execution. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function addPrinters(printers: Array, callback: AsyncCallback): void; /** * New printers have been found and notify Print SA. * @permission ohos.permission.MANAGE_PRINT_JOB * @param { Array } printers - Indicates new arrived printer lists. * @returns { Promise } the promise returned by the function. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function addPrinters(printers: Array): Promise; /** * Printers have been lost and notify Print SA. * @permission ohos.permission.MANAGE_PRINT_JOB * @param { Array } printerIds - Indicates the lost printer lists. * @param { AsyncCallback } callback - The callback function for indcating the result of API execution. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function removePrinters(printerIds: Array, callback: AsyncCallback): void; /** * Printers have been lost and notify Print SA. * @permission ohos.permission.MANAGE_PRINT_JOB * @param { Array } printerIds - Indicates the lost printer lists. * @returns { Promise } the promise returned by the function. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function removePrinters(printerIds: Array): Promise; /** * Update the information of the specific printers. * @permission ohos.permission.MANAGE_PRINT_JOB * @param { Array } printers - Indicates to be updated printer lists. * @param { AsyncCallback } callback - The callback function for indcating the result of API execution. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function updatePrinters(printers: Array, callback: AsyncCallback): void; /** * Update the information of the specific printers. * @permission ohos.permission.MANAGE_PRINT_JOB * @param { Array } printers - Indicates to be updated printer lists. * @returns { Promise } the promise returned by the function. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function updatePrinters(printers: Array): Promise; /** * Notify Print SA the state of printer has been changed. * @permission ohos.permission.MANAGE_PRINT_JOB * @param { string } printerId - Indicates id of the printer. * @param { PrinterState } state - Indicates state of the printer. * @param { AsyncCallback } callback - The callback function for indcating the result of API execution. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function updatePrinterState(printerId: string, state: PrinterState, callback: AsyncCallback): void; /** * Notify Print SA the state of printer has been changed. * @permission ohos.permission.MANAGE_PRINT_JOB * @param { string } printerId - Indicates id of the printer. * @param { PrinterState } state - Indicates state of the printer. * @returns { Promise } the promise returned by the function. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function updatePrinterState(printerId: string, state: PrinterState): Promise; /** * Notify Print SA the state of print job has been changed. * @permission ohos.permission.MANAGE_PRINT_JOB * @param { string} jobId - Indicates id of the print job. * @param { PrintJobState } state - Indicates new state of print job. * @param { PrintJobSubState } subState - Indicates sub state of print job. * @param { AsyncCallback } callback - The callback function for indcating the result of API execution. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function updatePrintJobState(jobId: string, state: PrintJobState, subState: PrintJobSubState, callback: AsyncCallback): void; /** * Notify Print SA the state of print job has been changed. * @permission ohos.permission.MANAGE_PRINT_JOB * @param { string} jobId - Indicates id of the print job. * @param { PrintJobState } state - Indicates new state of print job. * @param { PrintJobSubState } subState - Indicates sub state of print job. * @returns { Promise } the promise returned by the function. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function updatePrintJobState(jobId: string, state: PrintJobState, subState: PrintJobSubState): Promise; /** * Notify Print SA the state of print extension has been changed. * @permission ohos.permission.MANAGE_PRINT_JOB * @param { string } info - Indicates changed information of print extension. * @param { AsyncCallback } callback - The callback function for indcating the result of API execution. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function updateExtensionInfo(info: string, callback: AsyncCallback): void; /** * Notify Print SA the state of print extension has been changed. * @permission ohos.permission.MANAGE_PRINT_JOB * @param { string } info - Indicates changed information of print extension. * @returns { Promise } the promise returned by the function. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function updateExtensionInfo(info: string): Promise; /** * Get all the printJobs in the queue. * @permission ohos.permission.MANAGE_PRINT_JOB * @param { AsyncCallback } callback - The callback function for handling the printJob list found. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function queryAllPrintJobs(callback: AsyncCallback): void; /** * Get all the printJobs in the queue. * @permission ohos.permission.MANAGE_PRINT_JOB * @returns { Promise } the promise returned by the function. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 202 - not system application * @syscap SystemCapability.Print.PrintFramework * @systemapi Hide this for inner system use. * @since 10 */ function queryAllPrintJobs(): Promise; } export default print;