Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work "Cut" on QL 810w #13

Closed
kmlpandey77 opened this issue Jul 15, 2020 · 10 comments
Closed

Does not work "Cut" on QL 810w #13

kmlpandey77 opened this issue Jul 15, 2020 · 10 comments

Comments

@kmlpandey77
Copy link

kmlpandey77 commented Jul 15, 2020

I have use QL-810w, but "CUT " Function does not work. It's cut at last.

$printer->addCommand(new Command\Text('Hallo'));
$printer->addCommand(new Command\Cut(Command\Cut::FULL));  
$printer->addCommand(new Command\Text('Hallo 2'));
$printer->addCommand(new Command\Cut(Command\Cut::FULL));
@ntaylor-86
Copy link
Contributor

You are right @kmlpandey77

I tried what you have in your initial comment and any Text that is added gets printed on the same label.

( Initially test on the left hand side. )
bart_lisa_maggie

I wrote a flushCommands() method that empties the $command array. So you are able to do something like this.

$labels = ['Bart', 'Lisa', 'Maggie'];

foreach ($labels as $label) {
    $printer->addCommand(new Command\Text( $label ));
    $printer->printLabel();
    $printer->flushCommands();
}

Which resulted in the labels on the right hand side of my image.

I'm sure @RamyTalal has a better solution for us than my flushCommands() method?

@RamyTalal
Copy link
Owner

I think it's nicer to flush in the printLabel() method.

@ntaylor-86
Copy link
Contributor

That's even better!

@kmlpandey77
Copy link
Author

Thank you @ntaylor-86,

I dont get flushCommands() method.

but I get a solution for now, (Using dash [------])
image

$printer->addCommand(new Command\Text("Order No: " . $sale->getOrderNumber() . "\n"));
foreach ($sale->items as $item) {  //$sale->item is food list
    for ($i=0; $item->qty > $i; $i++) {
        $printer->addCommand(new Command\Text("----------------\n"));  // love to use CUT::HALF or CUT:: CNAIN instead of dash [-----]
        $printer->addCommand(new Command\Text($item->item_title . "\n"));
    }
}
$printer->printLabel();

@ntaylor-86
Copy link
Contributor

@kmlpandey77 from your photo, is your end goal is to have 6 different labels?

@ntaylor-86
Copy link
Contributor

I have use QL-810w, but "CUT " Function does not work. It's cut at last.

$printer->addCommand(new Command\Text('Hallo'));
$printer->addCommand(new Command\Cut(Command\Cut::FULL));  
$printer->addCommand(new Command\Text('Hallo 2'));
$printer->addCommand(new Command\Cut(Command\Cut::FULL));

@RamyTalal is the Cut command meant to work how @kmlpandey77 has implemented there?
Does that work on your printer? Thanks.

@RamyTalal
Copy link
Owner

@ntaylor-86 That works.

@mgjuhler
Copy link

flushCommands

@ntaylor-86 can you share the content of your flushCommands ?

@ntaylor-86
Copy link
Contributor

flushCommands

@ntaylor-86 can you share the content of your flushCommands ?

LoL. It's been two and a half years since I looked at this. I don't remember off the top of my head, but when I get a second I'll check it out.

@ntaylor-86
Copy link
Contributor

@mgjuhler

You can see the command implemented in this commit: ntaylor-86@838973b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants