GithubHelp home page GithubHelp logo

bpac-react's Introduction

bpac-react

JavaScript module for communicating with the Brother QL-series label printers.
Currently the module has no typings whatsoever, as the internal code is dug up from old Brother instructions (from when JScript was a thing!). Anyone brave enough to figure out all the one-letter variables inside is more than welcome to contribute.

Until then, just follow the steps below to print your labels.

Installation

Use npm to install the package.

npm install bpac-react

Your client computer will also need the b-PAC SDK.
IMPORTANT NOTE: Only the 32-bit versions of the b-PAC SDK work. Don't bother installing the 64-bit versions.

You can create templates for your labels with the P-Touch Editor (the editor is device-specific).

Usage

import { IDocument } from "bpac-react";

const printAFile = async ()
=> {
  const objDoc = bpac.IDocument;
  const ret = await objDoc.Open("C:\absolute\path\to\file\template.lbx");
  // most of the functions from the SDK return true/false for success
  if(ret === true){ 

     // Set the data in a barcode/QR code inside your template file
     await objDoc.SetBarcodeData(
            await objDoc.GetBarcodeIndex("some-barcode"),
            "The text to be inside the barcode"
          );
     
     // Set the text in a Text object inside your template file
     (await objDoc.GetObject("some-text")).Text = "Your Text";

     // Start the print
     await objDoc.StartPrint('', 0);
     await objDoc.PrintOut(1, 0);
     await objDoc.EndPrint();
     await objDoc.Close();
  }
}

Contributing

Any contribution is absolutely welcome. Create a pull request and I'll merge it ASAP.

License

MIT

bpac-react's People

Contributors

najathi avatar

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.