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

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

Construct a new print object
public __construct ( Mike42\Escpos\PrintConnectors\PrintConnector $connector, CapabilityProfile $profile = null )
$connector Mike42\Escpos\PrintConnectors\PrintConnector The PrintConnector to send data to. If not set, output is sent to standard output.
$profile CapabilityProfile Supported features of this printer. If not set, the "default" CapabilityProfile will be used, which is suitable for Epson printers.
    public function __construct(PrintConnector $connector, CapabilityProfile $profile = null)
    {
        /* Set connector */
        $this->connector = $connector;
        /* Set capability profile */
        if ($profile === null) {
            $profile = CapabilityProfile::load('default');
        }
        $this->profile = $profile;
        /* Set buffer */
        $buffer = new EscposPrintBuffer();
        $this->buffer = null;
        $this->setPrintBuffer($buffer);
        $this->initialize();
    }