Wednesday, June 11, 2014

Ptouch Javascript Interpreter

Here's my Ptouch Javascript interpreter page. It's just a fun little javascript project to interpret the Ptouch protocol to generate an image from a binary printer file. I just print the label to a file and then browse to the saved file to render. The code is pretty simple and uses XMLHttpRequest to open up a file that resides in the webpage directory and FileReader to open a file with the file input box. It's a neat example of how to read and parse arbitrary binary data in javascript.

If you click on the row of buttons in the third row, there are demos of output from various P-Touch printers like the pt9200, pt9500 and the pt9700. Every time you click on one of these it will fetch the binary data and add an image at the end of the webpage. You can also scroll down and see how it processed the binary data.

If you click on the button that says 384 pixels or the one that says 720 pixels it will set the height of the canvas to 384 and 720 pixels respectively.

It's also kind of cool to right click on the canvas area and view it as an image.




PTouch Javascript Interpreter

2 comments:

  1. looks very interesting but the links to the interpreter are deadends

    ReplyDelete
    Replies
    1. Try here - I put some files here:

      http://ptouchman.weebly.com/blog

      Delete