Mike42\Escpos\Printer::close PHP Метод

close() публичный Метод

Close the underlying buffer. With some connectors, the job will not actually be sent to the printer until this is called.
public close ( )
    public function close()
    {
        $this->connector->finalize();
    }

Usage Example

 function testText()
 {
     /* Smoke test over text rendering with each profile.
      * Just makes sure we can attempt to print 'hello world' and a non-ASCII
      * char without anything blowing up */
     foreach ($this->checklist as $obj) {
         $connector = new DummyPrintConnector();
         $printer = new Printer($connector, $obj);
         $printer->text("Hello world €\n");
         $printer->close();
         // Check for character cache
         $profileName = $obj->getId();
         $expected = "Characters-{$profileName}.ser.z";
         $filename = __DIR__ . "/../../src/Mike42/Escpos/PrintBuffers/cache/{$expected}";
         $this->assertFileExists($filename);
     }
 }
All Usage Examples Of Mike42\Escpos\Printer::close