Mike42\Escpos\PrintConnectors\CupsPrintConnector::finalize PHP Method

finalize() public method

Send job to printer.
public finalize ( )
    public function finalize()
    {
        $data = implode($this->buffer);
        $this->buffer = null;
        // Build command to work on data
        $tmpfname = tempnam(sys_get_temp_dir(), 'print-');
        file_put_contents($tmpfname, $data);
        $cmd = sprintf("lp -d %s %s", escapeshellarg($this->printerName), escapeshellarg($tmpfname));
        try {
            $this->getCmdOutput($cmd);
        } catch (Exception $e) {
            unlink($tmpfname);
            throw $e;
        }
        unlink($tmpfname);
    }