0.4.5 • Published 6 months ago

@types/printer v0.4.5

Weekly downloads
177
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/printer

Summary

This package contains type definitions for printer (https://github.com/tojocky/node-printer).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/printer.

index.d.ts

// Type definitions for printer 0.4
// Project: https://github.com/tojocky/node-printer
// Definitions by: Christos Panagiotakopoulos <https://github.com/chrispanag>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

/// <reference types="node" />

export function getPrinters(): PrinterDetails[];
export function getPrinter(printerName: string): PrinterDetails;
export function getPrinterDriverOptions(printerName: string): PrinterDriverOptions;
export function getSelectedPaperSize(printerName: string): string;
export function getDefaultPrinterName(): string | undefined;
export function printDirect(options: PrintDirectOptions): void;
export function printFile(options: PrintFileOptions): void;
export function getSupportedPrintFormats(): string[];
export function getJob(printerName: string, jobId: number): JobDetails;
export function setJob(printerName: string, jobId: number, command: 'CANCEL' | string): void;
export function getSupportedJobCommands(): string[];

export interface PrintDirectOptions {
    data: string | Buffer;
    printer?: string | undefined;
    type?: 'RAW' | 'TEXT' | 'PDF' | 'JPEG' | 'POSTSCRIPT' | 'COMMAND' | 'AUTO' | undefined;
    options?: { [key: string]: string } | undefined;
    success?: PrintOnSuccessFunction | undefined;
    error?: PrintOnErrorFunction | undefined;
}

export interface PrintFileOptions {
    filename: string;
    printer?: string | undefined;
    success?: PrintOnSuccessFunction | undefined;
    error?: PrintOnErrorFunction | undefined;
}

export type PrintOnSuccessFunction = (jobId: string) => any;
export type PrintOnErrorFunction = (err: Error) => any;

export interface PrinterDetails {
    name: string;
    isDefault: boolean;
    options: { [key: string]: string; };
}

export interface PrinterDriverOptions {
    [key: string]: { [key: string]: boolean; };
}

export interface JobDetails {
    id: number;
    name: string;
    printerName: string;
    user: string;
    format: string;
    priority: number;
    size: number;
    status: JobStatus[];
    completedTime: Date;
    creationTime: Date;
    processingTime: Date;
}

export type JobStatus = 'PAUSED' | 'PRINTING' | 'PRINTED' | 'CANCELLED' | 'PENDING' | 'ABORTED';

Additional Details

  • Last updated: Thu, 16 Dec 2021 22:32:04 GMT
  • Dependencies: @types/node
  • Global values: none

Credits

These definitions were written by Christos Panagiotakopoulos.

0.4.5

6 months ago

0.4.4

7 months ago

0.4.3

8 months ago

0.4.2

2 years ago

0.4.1

3 years ago

0.4.0

4 years ago