Skip to main content

OH_Print_ConnectPrinter

Function OH_Print_ConnectPrinter 

Source
pub unsafe extern "C" fn OH_Print_ConnectPrinter(
    printerId: *const c_char,
) -> Print_ErrorCode
Available on crate features api-12 and print only.
Expand description

This API connects to the printer using the printer id.

ohos.permission.PRINT

§Arguments

  • printerId - The id of the printer to be connected.

§Returns

  • Returns Print_ErrorCode if the execution is successful. [PRINT_ERROR_NO_PERMISSION] The permission ohos.permission.PRINT is needed. [PRINT_ERROR_RPC_FAILURE] Unable to connect to the print service. [PRINT_ERROR_INVALID_PRINTER] The printer should be in the list of discovered printers. [PRINT_ERROR_SERVER_FAILURE] Unable to find an extension responsible for the printer.

Required System Capabilities: SystemCapability.Print.PrintFramework

Available since API-level: 12