npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

lidta-capacitor-bl-printer

v0.0.3

Published

Print directly to bl printer

Readme

lidta-capacitor-bl-printer

lidta-capacitor-bl-printer is the first free Capacitor solution to fully support print most documents including html with structure and styles to blutooth pos thermal printers without breaking any sweat

Currently only available for android devices

Install

npm install lidta-capacitor-bl-printer
npx cap sync

API

printBase64(...)

printBase64(options: { msg: string; align: number; }) => Promise<{ value: boolean; }>

Print base64 string

| Param | Type | | ------------- | -------------------------------------------- | | options | { msg: string; align: number; } |

Returns: Promise<{ value: boolean; }>


connect(...)

connect(options: { address: string; }) => Promise<{ value: boolean; }>

| Param | Type | | ------------- | --------------------------------- | | options | { address: string; } |

Returns: Promise<{ value: boolean; }>


disconnect()

disconnect() => Promise<{ value: boolean; }>

Returns: Promise<{ value: boolean; }>


Documentation

Visit Documentation Website

Vue 3 Capacitor 6 exmaple

The following component uses vue 3 with composition API Syntax

<script setup>
import { onMounted, ref } from 'vue'; //vue life cycle hooks(onMounted) and reactive (ref)
import html2canvas from 'html2canvas'; //converts the html or any text to base64Image
import { LidtaCapacitorBlPrinter } from 'lidta-capacitor-bl-printer'; //lidta-capacitor-bl-printer plugin

const devices = ref([]);
const connectedPrinter = ref({});
const content = ref(null);

const listDevices = async () => {
  await LidtaCapacitorBlPrinter.getPairedDevices().then((result) => {
      devices.value = result.devices || [];
  }).catch((error) => {
    alert(error);
  });
}

const printReceipt = async (device) => {
 await  LidtaCapacitorBlPrinter.connect({ address: device.address }).then(async () => {
   connectedPrinter.value = device.name;
   await  html2canvas(
      content.value,
    ).then(async (canvas) => {
    const base64Image =  canvas.toDataURL("image/png");
    LidtaCapacitorBlPrinter.printBase64({msg: base64Image, align: 1, /*0=>left 1=>center, 2=>right anything else=>invalid */ 
    }).then(() => { LidtaCapacitorBlPrinter.disconnect();
   }).catch((error) => alert(error)).finally(async () => {});
  }).catch((error) => alert(error));
  }).catch((error) => alert(error))
};  
</script>

The following template uses Vuetify

<template>
<div class=" mt-8">
  <div  class="text-center" >
    <VBtn color="warning" class="text-center" variant="tonal"  @click="listDevices">
      <VIcon icon="mdi-printer" size="24" color="info" ></VIcon>List Connected Devices</VBtn>
  </div>
  
 <div class="text-center">
   <VBtn variant="tonal" class="mt-1" v-for="device in devices" :key="device" @click="printReceipt(device)" color="indigo">
  <VIcon icon="mdi-printer" ></VIcon>  Print on {{ device.name }} 
  </VBtn>
 </div>
  <div class="text-center">
    connected {{ connectedPrinter?.name }}
  </div>

<div  ref="content" id="content">
    <h1>Hellow World</h1>
    <img  height="80" width="80" src="@/assets/logo.png"  />
</div>

Clone Full Vue 3 Capacitor 6 Example here

Useful Links

Official Website Lidta tech

Support the Project

This is the first free solution to fully support print most documents including html with structure and styles to blutooth pos thermal printers without breaking any sweat.

Your support is greatly appreciated and will help me keep improving this project.