mirror of
https://gitee.com/openharmony/interface_sdk-js
synced 2024-10-07 06:03:30 +00:00
!13772 更新打印相关接口
Merge pull request !13772 from 郑志豪/OpenHarmony-5.0-Release
This commit is contained in:
commit
b75c7fa092
43
api/@ohos.app.ability.PrintExtensionAbility.d.ts
vendored
43
api/@ohos.app.ability.PrintExtensionAbility.d.ts
vendored
@ -25,8 +25,9 @@ import type print from './@ohos.print';
|
||||
* class of print extensionAbility.
|
||||
*
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @stagemodelonly
|
||||
* @since 12
|
||||
* @systemapi Hide this for inner system use.
|
||||
* @StageModelOnly
|
||||
* @since 10
|
||||
*/
|
||||
export default class PrintExtensionAbility {
|
||||
|
||||
@ -35,8 +36,9 @@ export default class PrintExtensionAbility {
|
||||
* @param { Want } want - call print page want params.
|
||||
* @throws { BusinessError } 202 - not system application
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @stagemodelonly
|
||||
* @since 12
|
||||
* @systemapi Hide this for inner system use.
|
||||
* @StageModelOnly
|
||||
* @since 10
|
||||
*/
|
||||
onCreate(want: Want): void;
|
||||
|
||||
@ -44,8 +46,9 @@ export default class PrintExtensionAbility {
|
||||
* Called once to start to discover the printers connected with the device.
|
||||
* @throws { BusinessError } 202 - not system application
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @stagemodelonly
|
||||
* @since 12
|
||||
* @systemapi Hide this for inner system use.
|
||||
* @StageModelOnly
|
||||
* @since 10
|
||||
*/
|
||||
onStartDiscoverPrinter(): void;
|
||||
|
||||
@ -53,8 +56,9 @@ export default class PrintExtensionAbility {
|
||||
* Called once to stop discovering the printer.
|
||||
* @throws { BusinessError } 202 - not system application
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @stagemodelonly
|
||||
* @since 12
|
||||
* @systemapi Hide this for inner system use.
|
||||
* @StageModelOnly
|
||||
* @since 10
|
||||
*/
|
||||
onStopDiscoverPrinter(): void;
|
||||
|
||||
@ -63,8 +67,9 @@ export default class PrintExtensionAbility {
|
||||
* @param { number } printerId - connect the printerId.
|
||||
* @throws { BusinessError } 202 - not system application
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @stagemodelonly
|
||||
* @since 12
|
||||
* @systemapi Hide this for inner system use.
|
||||
* @StageModelOnly
|
||||
* @since 10
|
||||
*/
|
||||
onConnectPrinter(printerId: number): void;
|
||||
|
||||
@ -73,8 +78,9 @@ export default class PrintExtensionAbility {
|
||||
* @param { number } printerId - connect the printerId.
|
||||
* @throws { BusinessError } 202 - not system application
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @stagemodelonly
|
||||
* @since 12
|
||||
* @systemapi Hide this for inner system use.
|
||||
* @StageModelOnly
|
||||
* @since 10
|
||||
*/
|
||||
onDisconnectPrinter(printerId: number): void;
|
||||
|
||||
@ -84,7 +90,7 @@ export default class PrintExtensionAbility {
|
||||
* @throws { BusinessError } 202 - not system application
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @systemapi Hide this for inner system use.
|
||||
* @stagemodelonly
|
||||
* @StageModelOnly
|
||||
* @since 10
|
||||
*/
|
||||
onStartPrintJob(jobInfo: print.PrintJob): void;
|
||||
@ -95,7 +101,7 @@ export default class PrintExtensionAbility {
|
||||
* @throws { BusinessError } 202 - not system application
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @systemapi Hide this for inner system use.
|
||||
* @stagemodelonly
|
||||
* @StageModelOnly
|
||||
* @since 10
|
||||
*/
|
||||
onCancelPrintJob(jobInfo: print.PrintJob): void;
|
||||
@ -107,7 +113,7 @@ export default class PrintExtensionAbility {
|
||||
* @throws { BusinessError } 202 - not system application
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @systemapi Hide this for inner system use.
|
||||
* @stagemodelonly
|
||||
* @StageModelOnly
|
||||
* @since 10
|
||||
*/
|
||||
onRequestPrinterCapability(printerId: number): print.PrinterCapability;
|
||||
@ -119,7 +125,7 @@ export default class PrintExtensionAbility {
|
||||
* @throws { BusinessError } 202 - not system application
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @systemapi Hide this for inner system use.
|
||||
* @stagemodelonly
|
||||
* @StageModelOnly
|
||||
* @since 10
|
||||
*/
|
||||
onRequestPreview(jobInfo: print.PrintJob): string;
|
||||
@ -128,8 +134,9 @@ export default class PrintExtensionAbility {
|
||||
* Called once to finalize the extensionAbility.
|
||||
* @throws { BusinessError } 202 - not system application
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @stagemodelonly
|
||||
* @since 12
|
||||
* @systemapi Hide this for inner system use.
|
||||
* @StageModelOnly
|
||||
* @since 10
|
||||
*/
|
||||
onDestroy(): void;
|
||||
}
|
||||
|
292
api/@ohos.print.d.ts
vendored
292
api/@ohos.print.d.ts
vendored
@ -156,7 +156,7 @@ declare namespace print {
|
||||
* @since 11
|
||||
*/
|
||||
onStartLayoutWrite(jobId: string, oldAttrs: PrintAttributes, newAttrs: PrintAttributes, fd: number,
|
||||
writeResultCallback: (jobId: string, writeResult: PrintFileCreationState) => void): void;
|
||||
writeResultCallback: (jobId: string, writeResult: PrintFileCreationState) => void): void;
|
||||
|
||||
/**
|
||||
* Implement this function to listen job status change.
|
||||
@ -235,7 +235,7 @@ declare namespace print {
|
||||
* @since 11
|
||||
*/
|
||||
function print(jobName: string, printAdapter: PrintDocumentAdapter, printAttributes: PrintAttributes,
|
||||
context: Context): Promise<PrintTask>;
|
||||
context: Context): Promise<PrintTask>;
|
||||
|
||||
/**
|
||||
* defines print attributes.
|
||||
@ -2146,7 +2146,7 @@ declare namespace print {
|
||||
* @since 11
|
||||
*/
|
||||
function startGettingPrintFile(jobId: string, printAttributes: PrintAttributes, fd: number,
|
||||
onFileStateChanged: Callback<PrintFileCreationState>): void;
|
||||
onFileStateChanged: Callback<PrintFileCreationState>): void;
|
||||
|
||||
/**
|
||||
* Notify print service the information.
|
||||
@ -2217,292 +2217,6 @@ declare namespace print {
|
||||
* @since 12
|
||||
*/
|
||||
function notifyPrintServiceEvent(event: ApplicationEvent): Promise<void>;
|
||||
|
||||
/**
|
||||
* New printers have been found and notify Print SA.
|
||||
* @permission ohos.permission.PRINT
|
||||
* @param { PrinterInformation } printerInformation - Indicates new arrived printer lists.
|
||||
* @returns { Promise<void> } the promise returned by the function.
|
||||
* @throws { BusinessError } 201 - the application does not have permission to call this function.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @since 12
|
||||
*/
|
||||
function addPrinterToDiscovery(printerInformation: PrinterInformation): Promise<void>;
|
||||
|
||||
/**
|
||||
* Update the information of the specific printer.
|
||||
* @permission ohos.permission.PRINT
|
||||
* @param { PrinterInformation } printerInformation - Indicates to be updated printer lists.
|
||||
* @returns { Promise<void> } the promise returned by the function.
|
||||
* @throws { BusinessError } 201 - the application does not have permission to call this function.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @since 12
|
||||
*/
|
||||
function updatePrinterInDiscovery(printerInformation: PrinterInformation): Promise<void>;
|
||||
|
||||
/**
|
||||
* Notify Print SA to remove printer.
|
||||
* @permission ohos.permission.PRINT
|
||||
* @param { string } printerId - Indicates the lost printer lists.
|
||||
* @returns { Promise<void> } the promise returned by the function.
|
||||
* @throws { BusinessError } 201 - the application does not have permission to call this function.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @since 12
|
||||
*/
|
||||
function removePrinterFromDiscovery(printerId: string): Promise<void>;
|
||||
|
||||
/**
|
||||
* Get printerInformation by printer id.
|
||||
* @permission ohos.permission.PRINT
|
||||
* @param { string } printerId - Indicates id of the printer.
|
||||
* @returns { Promise<PrinterInformation> } the promise returned by the function.
|
||||
* @throws { BusinessError } 201 - the application does not have permission to call this function.
|
||||
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types.
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @since 12
|
||||
*/
|
||||
function getPrinterInformationById(printerId: string): Promise<PrinterInformation>;
|
||||
|
||||
/**
|
||||
* defines printer information.
|
||||
* @typedef PrinterInformation
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @since 12
|
||||
*/
|
||||
interface PrinterInformation {
|
||||
/**
|
||||
* Printer id.
|
||||
* @type { string }
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @since 12
|
||||
*/
|
||||
printerId: string;
|
||||
|
||||
/**
|
||||
* Printer name.
|
||||
* @type { string }
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @since 12
|
||||
*/
|
||||
printerName: string;
|
||||
|
||||
/**
|
||||
* Current printer status.
|
||||
* @type { PrinterStatus }
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @since 12
|
||||
*/
|
||||
printerStatus: PrinterStatus;
|
||||
|
||||
/**
|
||||
* Printer description.
|
||||
* @type { ?string }
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @since 12
|
||||
*/
|
||||
description?: string;
|
||||
|
||||
/**
|
||||
* Printer capabilities.
|
||||
* @type { ?PrinterCapabilities }
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @since 12
|
||||
*/
|
||||
capability?: PrinterCapabilities;
|
||||
|
||||
/**
|
||||
* Printer uri.
|
||||
* @type { ?string }
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @since 12
|
||||
*/
|
||||
uri?: string;
|
||||
|
||||
/**
|
||||
* Printer make.
|
||||
* @type { ?string }
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @since 12
|
||||
*/
|
||||
printerMake?: string;
|
||||
|
||||
/**
|
||||
* Detail information in json format.
|
||||
* @type { ?string }
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @since 12
|
||||
*/
|
||||
options?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* defines printer capabilities.
|
||||
* @typedef PrinterCapabilities
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @since 12
|
||||
*/
|
||||
interface PrinterCapabilities {
|
||||
/**
|
||||
* The page size list supported by the printer.
|
||||
* @type { Array<PrintPageSize> }
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @since 12
|
||||
*/
|
||||
supportedPageSizes: Array<PrintPageSize>;
|
||||
|
||||
/**
|
||||
* Array of supported color mode.
|
||||
* @type { Array<PrintColorMode> }
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @since 12
|
||||
*/
|
||||
supportedColorModes: Array<PrintColorMode>;
|
||||
|
||||
/**
|
||||
* Array of supported duplex mode.
|
||||
* @type { Array<PrintDuplexMode> }
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @since 12
|
||||
*/
|
||||
supportedDuplexModes: Array<PrintDuplexMode>;
|
||||
|
||||
/**
|
||||
* Array of supported print media types.
|
||||
* @type { ?Array<string> }
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @since 12
|
||||
*/
|
||||
supportedMediaTypes?: Array<string>;
|
||||
|
||||
/**
|
||||
* Array of supported print quality.
|
||||
* @type { ?Array<PrintQuality> }
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @since 12
|
||||
*/
|
||||
supportedQualities?: Array<PrintQuality>;
|
||||
|
||||
/**
|
||||
* Array of supported print orientation.
|
||||
* @type { ?Array<PrintOrientationMode> }
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @since 12
|
||||
*/
|
||||
supportedOrientations?: Array<PrintOrientationMode>;
|
||||
|
||||
/**
|
||||
* Advanced capability in json format.
|
||||
* @type { ?string }
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @since 12
|
||||
*/
|
||||
options?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enumeration of Print Quality.
|
||||
* @enum { number } PrintQuality
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @since 12
|
||||
*/
|
||||
enum PrintQuality {
|
||||
/**
|
||||
* Draft quality mode.
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @since 12
|
||||
*/
|
||||
QUALITY_DRAFT = 3,
|
||||
|
||||
/**
|
||||
* Normal quality mode.
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @since 12
|
||||
*/
|
||||
QUALITY_NORMAL = 4,
|
||||
|
||||
/**
|
||||
* High quality mode.
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @since 12
|
||||
*/
|
||||
QUALITY_HIGH = 5,
|
||||
}
|
||||
|
||||
/**
|
||||
* Enumeration of Print OrientationMode.
|
||||
* @enum { number } PrintOrientationMode
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @since 12
|
||||
*/
|
||||
enum PrintOrientationMode {
|
||||
/**
|
||||
* Portrait mode.
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @since 12
|
||||
*/
|
||||
ORIENTATION_MODE_PORTRAIT = 0,
|
||||
|
||||
/**
|
||||
* Landscape mode.
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @since 12
|
||||
*/
|
||||
ORIENTATION_MODE_LANDSCAPE= 1,
|
||||
|
||||
/**
|
||||
* Reverse landscape mode.
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @since 12
|
||||
*/
|
||||
ORIENTATION_MODE_REVERSE_LANDSCAPE = 2,
|
||||
|
||||
/**
|
||||
* Reverse portrait mode.
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @since 12
|
||||
*/
|
||||
ORIENTATION_MODE_REVERSE_PORTRAIT = 3,
|
||||
|
||||
/**
|
||||
* Not specified.
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @since 12
|
||||
*/
|
||||
ORIENTATION_MODE_NONE = 4,
|
||||
}
|
||||
|
||||
/**
|
||||
* Enumeration of Printer Status.
|
||||
* @enum { number } PrinterStatus
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @since 12
|
||||
*/
|
||||
enum PrinterStatus {
|
||||
/**
|
||||
* Printer idle.
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @since 12
|
||||
*/
|
||||
PRINTER_IDLE = 0,
|
||||
|
||||
/**
|
||||
* Printer busy.
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @since 12
|
||||
*/
|
||||
PRINTER_BUSY = 1,
|
||||
|
||||
/**
|
||||
* Printer not available.
|
||||
* @syscap SystemCapability.Print.PrintFramework
|
||||
* @since 12
|
||||
*/
|
||||
PRINTER_UNAVAILABLE = 2,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default print;
|
Loading…
Reference in New Issue
Block a user