class printing_printgcp extends PrintingDriver (View source)

Class to provide printing with Google Cloud Print

Constants

LOGIN_URL

PRINTERS_SEARCH_URL

PRINTERS_GET_JOBS

PRINT_URL

Properties

DoliDB $db
string $error from  PrintingDriver
string[] $errors from  PrintingDriver
string $name
string $desc
string $resprint from  PrintingDriver
string $active
string $picto
array<string|int, string|array{varname: string, info: string, type: "info", renew?: string, delete?: string}|array{enabled: int<0, 1>, type: "submit"}> $conf
string $google_id
string $google_secret

Methods

__construct($db)

Constructor

static 
listDrivers($db, int $maxfilenamelength = 0)

Return list of printing driver

getDesc()

Return description of Printing Module

listAvailablePrinters()

Return list of available printers

getlistAvailablePrinters()

Return list of available printers

int
printFile(string $file, string $module, string $subdir = '')

Print selected file

int
listJobs($module = null)

List jobs print

getlistAvailableGcpPrinters()

Return list of available printers (internal format)

sendPrintToPrinter($printerid, string $printjobtitle, $filepath, $contenttype)

Sends document to the printer

Details

__construct($db)

Constructor

@param DoliDB $db Database handler

Parameters

$db

static listDrivers($db, int $maxfilenamelength = 0)

Return list of printing driver

@param DoliDB $db Database handler

Parameters

$db
int $maxfilenamelength

Max length of value to show @return array<string,string> List of drivers

getDesc()

Return description of Printing Module

@return string Return translation of key PrintingModuleDescXXX where XXX is module name, or $this->desc if not exists

listAvailablePrinters()

Return list of available printers

@return int 0 if OK, >0 if KO

getlistAvailablePrinters()

Return list of available printers

@return array<array{name:string,displayName:string,id:string,ownerName:string,status:string,connectionStatus:string,type:string}> list of printers

int printFile(string $file, string $module, string $subdir = '')

Print selected file

Parameters

string $file file
string $module module
string $subdir

subdir for file

Return Value

int

0 if OK, >0 if KO

int listJobs($module = null)

List jobs print

@param ?string $module module

Parameters

$module

Return Value

int

0 if OK, >0 if KO

getlistAvailableGcpPrinters()

Return list of available printers (internal format)

@return array{available:array<array{name:string,displayName:string,id:string,ownerName:string,status:string,connectionStatus:string,type:string}>} list of printers

sendPrintToPrinter($printerid, string $printjobtitle, $filepath, $contenttype)

Sends document to the printer

@param string $printerid Printer id returned by Google Cloud Print

Parameters

$printerid
string $printjobtitle

Job Title @param string $filepath File Path to be send to Google Cloud Print @param string $contenttype File content type by example application/pdf, image/png @return array{status:int<0,1>,errorcode:string,errormessage:string} status array

$filepath
$contenttype