GithubHelp home page GithubHelp logo

Comments (10)

ntaylor-86 avatar ntaylor-86 commented on August 10, 2024 1

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?

from label-printer.

RamyTalal avatar RamyTalal commented on August 10, 2024 1

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

from label-printer.

ntaylor-86 avatar ntaylor-86 commented on August 10, 2024

That's even better!

from label-printer.

kmlpandey77 avatar kmlpandey77 commented on August 10, 2024

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();

from label-printer.

ntaylor-86 avatar ntaylor-86 commented on August 10, 2024

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

from label-printer.

ntaylor-86 avatar ntaylor-86 commented on August 10, 2024

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.

from label-printer.

RamyTalal avatar RamyTalal commented on August 10, 2024

@ntaylor-86 That works.

from label-printer.

mgjuhler avatar mgjuhler commented on August 10, 2024

flushCommands

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

from label-printer.

ntaylor-86 avatar ntaylor-86 commented on August 10, 2024

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.

from label-printer.

ntaylor-86 avatar ntaylor-86 commented on August 10, 2024

@mgjuhler

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

from label-printer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.