Label-Printer icon indicating copy to clipboard operation
Label-Printer copied to clipboard

I can't print barcode with QL810W

Open IvanPagan opened this issue 2 years ago • 1 comments

Hi, I'm trying to print barcodes but allways have the same, a commands string, For example I got "itrhwzBCA04220007510" trying to print CA04220007510 barcode with code128.

        $stream = stream_socket_client('tcp://'.$printer_ip.':9100', $errorNumber, $errorString);

        $printer = new Printer(new Template(2, $stream));

        $printer->addCommand(new Command\Barcode($product->reference, 29, Command\Barcode::WIDTH_MEDIUM, 'CODE39', true, 2.5));

        $printer->printLabel();
        
        fclose($stream);

Whats happend? Ineed to do something more?

Thanks

IvanPagan avatar Jul 07 '22 16:07 IvanPagan

Hi @IvanPagan,

When using templates. You add the object you want to manipulate in your template and give it a unique Object Name in the P-touch Editor software.

Then you can use the ObjectCommand interface like so to change the values in your template,

$printer = new Printer(new Template(5, $stream)); // Template #5 stored on the printer

$printer->addCommand(new Command\ObjectCommand('barcode', "123456"));

$printer->addCommand(new Command\ObjectCommand('text', "IvanPagan"));

$printer->printLabel();

label_printer_issue_29

ntaylor-86 avatar Jul 26 '22 22:07 ntaylor-86