The Brother bPac printer SDK for Web Browsers simplifies the integration of the b-PAC SDK, providing a user-friendly interface for common tasks such as printing and obtaining image data. This SDK aims to enhance accessibility through modern JavaScript practices and thorough documentation, making it a valuable tool for developers working on web-based printing solutions
-
Modern JavaScript: The SDK has been refactored to use modern JavaScript practices, making it more accessible for developers familiar with contemporary web development.
-
Documentation: Comprehensive documentation has been added to the codebase, ensuring that developers have clear insights into the functionality and usage of each module.
-
IntelliSense Support: With well-documented code and consistent naming conventions, developers can enjoy improved IntelliSense support for a smoother coding experience.
Before using the Brother Printer SDK for Web Browsers, ensure you meet the following prerequisites:
-
Supported Printer Model:
- Check the list of supported printer models here. Ensure that your Brother printer is on the list for compatibility with this SDK. check src folder to identify current bpac version (example: bpac-v3.4.js).
-
Driver Installation:
- Install the appropriate printer driver for your Brother printer on your system. Visit the Brother Solutions Center to download and follow the installation instructions provided by Brother.
-
Template Printing Setup:
- Ensure that you can successfully print directly from the template file. This may involve configuring your printer settings.
-
Brother b-PAC Extension:
- Install the Brother b-Pac extension for your web browser from the respective extension store. Ensure that the extension is activated and running.
Extension Links:
- Brother b-Pac Extension for Chrome - Link to Chrome Extension.
- Brother b-Pac Extension for Edge - Link to Edge Extension.
- Brother b-Pac Extension for Firefox - Link to Firefox Add-ons.
Ensure that all prerequisites are met to guarantee a seamless experience.
Package Manager
$ npm i bpac-js
Content Delivery Network - Latest
https://cdn.jsdelivr.net/npm/bpac-js@latest/dist/index.js
Note: While using the latest
tag is convenient, it is recommended to exercise caution, especially in production environments. The latest tag always points to the most recent version, which may include breaking changes. To ensure stability, consider specifying a specific version.
Visit the docs section in this repository to explore detailed guides and examples for utilizing the SDK functionalities.
If you encounter issues or have suggestions, feel free to contribute to the project. Your input is highly valued!
// Script File
import BrotherSdk from "https://cdn.jsdelivr.net/npm/bpac-js@2.0.3/dist/index.js";
const printBtn = document.getElementById("print-btn");
const tag = new BrotherSdk({
templatePath: "C:/Templates/shoe-template.lbx",
exportPath: "C:/Users/YourProfile/Desktop/Exported Labels/",
});
// The keys and values must match the objects/types in the template file.
const data = {
title: "Air Force 1",
price: "$149.99",
barcode: "091207567724",
date: new Date("2024-1-20"),
};
const options = {
copies: 1, // Optional - Defaults: 1
printName: "Air Force Label", // Optional - Defaults: BPAC-Document
highResolution: true // Optional
}
const sendToPrinter = async () => {
try {
const isPrinted = await tag.print(data, options);
console.log({isPrinted})
} catch (error) {
console.log({error})
}
};
printBtn.addEventListener("click", sendToPrinter);
Special thanks to Brother for their QL Series Printer SDK. This project wouldn't be possible without their technology.
Happy coding with Brother QL Series Printer SDK for Web Browsers! 🚀
This project is licensed under the MIT License.