1.0.1 • Published 1 year ago

smile-printer-sdk v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

README

Installation

Install the dependencies and devDependencies and run the test.js code below.

cd printer-sdk
npm i
node test.js

Code Example

Object for label

const obj = {
  type: 'label',
  logoImage: '',
  orderId: '23897891233',
  orderDate: '2024-04-30',
  label: '1221212212',
  awb: '233232332332',
  inr: '1000',
  weight: '25',
  shipToName: 'Rohit Kumar',
  shipAddress:
    'Jainammmm Broling Ltd UL 48 Shree Krishna Center Passport Office  Mithakhali Navrangpura Ahemdabad Gujrat India.',
  shipToMobileNumber: '9876543210',
  location: 'Ahemdabad Mondeal Square DC',
  pincode: '411014',
  shipFromName: 'Sai Enterprisesss',
  shipFromMobile: '9876543210',
  shipFromAddress: 'Shop No L3, Jail Road Indore, Indore MP 452007',
  shipFromGst: '27AAAAPO267H2ZN',
  returnName: 'Sai Entierprize',
  returnMobileNumber: '9876543210',
  returnAddress: '',
  width: 4, // 4 || 3
};

Object for Invoice

const obj = {
  type: 'invoice',
  awb: '23830488741123',
  creationDate: '01-05-2024',
  invoice: '1212121121212',
  gst: '27AAAAP0267H2ZN',
  soldBy: 'Sumedh Indulkar',
  soldByAddress:
    'Jainam Broking Ltd UL 48 Shree Krishna Center Passport Office Mithakhali Navrangpura Ahmedabad, Gujarat India 380009',
  billingName: 'Atlas Patel',
  billingAddress:
    'Jainam Broking Ltd UL 48 Shree Krishna Center Passport Office Mithakhali Navrangpura Mumbai, Maharashtra India 400001',
  shippingName: 'Gaurav Bhatti',
  shippingAddress:
    '17 Spandan Shopping center, Arunachal Road, Arjdham, Amar Nagarm Vadodara, India 390023',
  items: [
    {
      description: 'Mobile ',
      unitPrice: '20000',
      qty: '2',
      totalAmount: '40000',
    },
    {
      description: 'Laptoop ',
      unitPrice: '200000',
      qty: '2',
      totalAmount: '400000',
    },
  ],
  total: '40000',
  width: '4', //4 || 3
  //   dpi: "203", // depends on your printer
};

test.js

const { zebraPrinter } = require('./index.js');

const app = async () => {
  const { availablePrinters, setPrinter, print } = zebraPrinter();
  const printer = await availablePrinters();
  await setPrinter(printer[0]);
  await print(obj);
};

app();