1/* 2 * Copyright (c) 2023-2023 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 16export class PrintMargin { 17 top?: number; 18 bottom?: number; 19 left?: number; 20 right?: number; 21} 22 23export class PrinterRange { 24 startPage?: number; 25 endPage?: number; 26 pages?: Array<number>; 27} 28 29export class PreviewAttribute { 30 previewRange: PrinterRange; 31 result?: string; 32} 33 34export class PrintResolution { 35 id: string; 36 horizontalDpi: number; 37 verticalDpi: number; 38} 39 40export class PrintPageSize { 41 constructor(public id: string, public name: string, public width: number, public height: number) { 42 this.id = id; 43 this.name = name; 44 this.width = width; 45 this.height = height; 46 } 47} 48 49export class PrinterCapability { 50 colorMode: number; 51 duplexMode: number; 52 pageSize: Array<PrintPageSize>; 53 resolution?: Array<PrintResolution>; 54 minMargin?: PrintMargin; 55 option?: string; 56} 57 58export class PrinterInfo { 59 public printerId: string; 60 public printerName: string; 61 public printerState: number; 62 public printerIcon?: number; 63 public description?: string; 64 public capability?: PrinterCapability; 65 public option?: string; 66} 67 68@Observed 69export class PrintJob { 70 files: Array<string>; 71 fdList: Array<number>; 72 jobId: string; 73 printerId: string; 74 jobState: PrintJobState; 75 jobSubState: PrintJobSubState; 76 copyNumber: number; 77 pageRange: PrinterRange; 78 isSequential: boolean; 79 pageSize: PrintPageSize; 80 isLandscape: boolean; 81 colorMode: number; 82 duplexMode: number; 83 margin?: PrintMargin; 84 preview?: PreviewAttribute; 85 option?: string; 86} 87 88export class PrinterExtensionInfo { 89 extensionId: string; // extension id of printer extension 90 vendorId: string; // vendor id of extension 91 vendorName: string; // vendor name 92 vendorIcon: number; // resource id of vendor 93 version: string; // version of current printer extension 94} 95 96export enum PrinterState { 97 PRINTER_ADDED = 0, 98 PRINTER_REMOVED = 1, 99 PRINTER_UPDATE_CAP = 2, 100 PRINTER_CONNECTED = 3, 101 PRINTER_DISCONNECTED = 4, 102 PRINTER_RUNNING = 5, 103} 104 105export enum PrintJobState { 106 PRINT_JOB_PREPARED = 0, 107 PRINT_JOB_QUEUED = 1, 108 PRINT_JOB_RUNNING = 2, 109 PRINT_JOB_BLOCKED = 3, 110 PRINT_JOB_COMPLETED = 4, 111 PRINT_JOB_CANCELLING = 5, 112} 113 114export enum PrintJobSubState { 115 PRINT_JOB_COMPLETED_SUCCESS = 0, 116 PRINT_JOB_COMPLETED_FAILED = 1, 117 PRINT_JOB_COMPLETED_CANCELLED = 2, 118 PRINT_JOB_COMPLETED_FILE_CORRUPT = 3, 119 PRINT_JOB_BLOCK_OFFLINE = 4, 120 PRINT_JOB_BLOCK_BUSY = 5, 121 PRINT_JOB_BLOCK_CANCELLED = 6, 122 PRINT_JOB_BLOCK_OUT_OF_PAPER = 7, 123 PRINT_JOB_BLOCK_OUT_OF_INK = 8, 124 PRINT_JOB_BLOCK_OUT_OF_TONER = 9, 125 PRINT_JOB_BLOCK_JAMMED = 10, 126 PRINT_JOB_BLOCK_DOOR_OPEN = 11, 127 PRINT_JOB_BLOCK_SERVICE_REQUEST = 12, 128 PRINT_JOB_BLOCK_LOW_ON_INK = 13, 129 PRINT_JOB_BLOCK_LOW_ON_TONER = 14, 130 PRINT_JOB_BLOCK_REALLY_LOW_ON_INK = 15, 131 PRINT_JOB_BLOCK_BAD_CERTIFICATE = 16, 132 133 PRINT_JOB_BLOCK_ACCOUNT_ERROR = 18, 134 PRINT_JOB_BLOCK_PRINT_PERMISSION_ERROR = 19, 135 PRINT_JOB_BLOCK_PRINT_COLOR_PERMISSION_ERROR = 20, 136 PRINT_JOB_BLOCK_NETWORK_ERROR = 21, 137 PRINT_JOB_BLOCK_CONNECT_SERVER_ERROR = 22, 138 PRINT_JOB_BLOCK_LARGE_FILE_ERROR = 23, 139 PRINT_JOB_BLOCK_PARSE_FILE_ERROR = 24, 140 PRINT_JOB_BLOCK_FILE_CONVERT_SLOWLY = 25, 141 142 PRINT_JOB_RUNNING_UPLOADING_FILES = 26, 143 PRINT_JOB_RUNNING_CONVERTING_FILES = 27, 144 PRINT_JOB_BLOCK_UNKNOWN = 99 145} 146 147export class MessageEvent<T> { 148 data: T; 149} 150 151export class PrinterCapsOptions { 152 supportedMediaTypes: number[]; 153 supportedQualities: number[]; 154 make: string; 155} 156 157export class PrintJobOptions { 158 jobName: string; 159 jobNum: number; 160 jobDescription: string; 161 mediaType: string; 162 documentCategory: number; 163 printQuality: string; 164 printerName: string; 165 printerUri: string; 166 documentFormat: string; 167 files: string[]; 168} 169 170export enum PrinterFoundType { 171 FROM_P2P = 0, 172 FROM_EPRINT = 1, 173 FROM_LOCAL_NET = 2, 174 FROM_USB = 3 175} 176 177export enum DateTimeFormat { 178 DATE = 0, 179 DATE_TIME = 1, 180 TIME = 2 181} 182