NiimBlueLib Docs
    Preparing search index...

    Class AbstractPrintTaskAbstract

    Different printer models have different print algorithms. Print task defines this algorithm.

    const quantity = 1;

    const printTask = client.protocol.newPrintTask("B1", {
    totalPages: quantity
    });

    try {
    await printTask.printInit();

    // you can print multiple pages in a loop, make sure options.totalPages is set correctly
    await printTask.printPage(encodedImage, quantity); // encode your canvas with ImageEncoder.encodeCanvas
    await printTask.waitForPageFinished();
    // loop ends here

    await printTask.waitForFinished();
    } catch (e) {
    alert(e);
    } finally {
    await client.protocol.printEnd();
    }

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    pagesPrinted: number
    printOptions: PrintOptions
    protocol: NiimbotProtocol

    Methods

    • Returns void

    • Parameters

      • pagePrintProgress: number = 100
      • pageFeedProgress: number = 100

      Returns void

    • Check if this print task supports a specified page color

      Parameters

      Returns boolean

    • Parameters

      • stepPercent: number = 5

      Returns (current: number, total: number) => void

    • End print, cleanup

      Returns Promise<boolean>

    • Printer's printhead resolution in pixels

      Returns number | undefined

    • Prepare print (set label type, density, print start, ...)

      Returns Promise<void>

    • Print image with a specified number of copies

      Parameters

      Returns Promise<void>

    • Reset print task state (pages printed)

      Returns void

    • Update print options for this print task

      Parameters

      Returns void

    • Validate page before printing. Checks:

      • Page color is supported by this print task
      • Page color matches print task color
      • Added pages not does not exceed pagesPrinted

      Also increments pagesPrinted by quantity.

      Parameters

      Returns void

    • Wait for all print is finished

      Returns Promise<void>

    • Wait for page print is finished

      Returns Promise<void>