Skip to content

This sample javascript code, demonstrates how easy it is, to print to a Star Micronics thermal printer like TSP 654ii WebPRNT, using html2canvas open source library.

Notifications You must be signed in to change notification settings

w3cloud/starwebprint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

starwebprint

This sample javascript code, demonstrates how to print to a Star Micronics Thermal printer like TSP 654ii webprnt, using html2canvas open source library. Directly drawing to a HTML5 canvas is time consuming job, both to develop and to maintain. A significantly easier and better approach is to render a receipt with HTML div tags and convert it into canvas and send it to the printer

Following are the benefits of rendering first as html and convert it to canvas over dierctly drawing in the canvas:

  • While drawing text to a canvas, you have to code the word wrapping logic. HTML tags provide automatic word wrapping.
  • First you have to determine the height of the canvas (paper). Then in the second pass you have to draw. In essense you need a two pass logic. By using html to render, you eliminate this hussle.
  • Images are can be sized easily with html.
  • Easy code maintenance. You will be using the same technolgies (like angulajs) that you are already familier with.

Reference

About

This sample javascript code, demonstrates how easy it is, to print to a Star Micronics thermal printer like TSP 654ii WebPRNT, using html2canvas open source library.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published