harmony 鸿蒙ohprint.h

  • 2025-06-12
  • 浏览 (7)

ohprint.h

Overview

Declares APIs for discovering and connecting to printers, printing files, and querying the list of added printers and printer information.

Library: libohprint.so \@kit BasicServicesKit

System capability: SystemCapability.Print.PrintFramework

Since: 12

Related module: OH_Print

Summary

Structs

Name Description
struct Print_Margin Defines the page margin.
struct Print_PageSize Defines the page size.
struct Print_Range Defines the page range.
struct Print_PrintAttributes Defines the print attributes.
struct Print_PrintDocCallback Defines the print job callback.

Types

Name Description
typedef void(* Print_WriteResultCallback) (const char *jobId, uint32_t code) Defines a callback used to return the file write-back result.
typedef void(* Print_OnStartLayoutWrite) (const char *jobId, uint32_t fd, const Print_PrintAttributes *oldAttrs, const Print_PrintAttributes *newAttrs, Print_WriteResultCallback writeCallback) Defines a callback to be invoked when the file write-back starts.
typedef void(* Print_OnJobStateChanged) (const char *jobId, uint32_t state) Defines a callback used to return the print job state.

Enums

Name Description
Print_ErrorCode {
PRINT_ERROR_NONE = 0, PRINT_ERROR_NO_PERMISSION = 201, PRINT_ERROR_INVALID_PARAMETER = 401, PRINT_ERROR_GENERIC_FAILURE = 24300001,
PRINT_ERROR_RPC_FAILURE = 24300002, PRINT_ERROR_SERVER_FAILURE = 24300003, PRINT_ERROR_INVALID_EXTENSION = 24300004, PRINT_ERROR_INVALID_PRINTER = 24300005,
PRINT_ERROR_INVALID_PRINT_JOB = 24300006, PRINT_ERROR_FILE_IO = 24300007, PRINT_ERROR_UNKNOWN = 24300255
}
Enumerates the error codes.
Print_JobDocAdapterState {
PRINT_DOC_ADAPTER_PREVIEW_ABILITY_DESTROY = 0, PRINT_DOC_ADAPTER_PRINT_TASK_SUCCEED = 1, PRINT_DOC_ADAPTER_PRINT_TASK_FAIL = 2, PRINT_DOC_ADAPTER_PRINT_TASK_CANCEL = 3,
PRINT_DOC_ADAPTER_PRINT_TASK_BLOCK = 4, PRINT_DOC_ADAPTER_PREVIEW_ABILITY_DESTROY_FOR_CANCELED = 5, PRINT_DOC_ADAPTER_PREVIEW_ABILITY_DESTROY_FOR_STARTED = 6
}
Enumerates the print job states.

Functions

Name Description
Print_ErrorCode OH_Print_StartPrintByNative (const char *printJobName, Print_PrintDocCallback printDocCallback, void *context) Calls the API for opening the print preview page.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Basic Services Kit

harmony 鸿蒙DeviceInfo

harmony 鸿蒙InitSync

harmony 鸿蒙OH_Print

harmony 鸿蒙OsAccount

harmony 鸿蒙Pasteboard

harmony 鸿蒙Print_Margin

harmony 鸿蒙Print_PageSize

harmony 鸿蒙Print_PrintAttributes

harmony 鸿蒙Print_PrintDocCallback

0  赞