print labels on Epson LW-600p via app made with APP INV 2

389 views
Skip to first unread message

AUV AUV

unread,
Mar 8, 2018, 5:05:39 PM3/8/18
to MIT App Inventor Forum
I like to enhance my App made with App inventor 2 with printing a barcode label. 
I bought an Epson LW-600p labelprinter connected to android device by bluetooth.
Documentation of Epson shows api possibilities, but no web api available.
Is there a way to make a connection and send a csv file to the printer on my android device ? 
On windows you can make a layout file for the application ( .lea file ) and a csv file with the data and send it to the printer, also with api e.g. in excel.
Has someone experiences with this topic ?

With kind regards, Marijke

Chris Ward

unread,
Mar 8, 2018, 7:11:56 PM3/8/18
to mitappinv...@googlegroups.com
Hi Marijke

Epson have their own app, "Epson iLabel", so you could use ActivityStarter with that.

Do you have a link to show us more about .lea files, the supporting .csv file and how these can be sent to the printer via Excel? That sounds like an approach that might be possible within App Inventor.

Other possibility (unverified, just thinking out loud!): Incorporate the Epson Labelworks SDK as an App Inventor extension.

Although Epson's Android SDK information is extensive, it's also voluminous - I think creating an App Inventor extension is doable, but a lot of work. Probably not financially viable either, given that it is specific to only one manufacture's Android friendly printer.

AUV AUV

unread,
Mar 9, 2018, 2:23:39 AM3/9/18
to MIT App Inventor Forum
Thank you Chris for the quick response. 
I found all the information on https://support.epson.biz/lw/download.html
For windows they made an excel vba example with .lea ( layout ) file and csv file for data input. Attached the VBA example.
You will find as well the android sdk in the download with an example.
If I use iprint on my android device, you can save the layout file locally, but I cannot find it on my device. I do not know if I can make the layout on windows iprint application and use it in the same way in app inventor 2. 
In the past I did use webservices in app inventor ( send csv file to webshop ), but I never did use api like for epson printer.
I hope you can give me some advice.

With kind regards, Marijke
barcode.xlsm
EAN-8_12.lea

Abraham Getzler

unread,
Mar 9, 2018, 11:42:52 AM3/9/18
to MIT App Inventor Forum
I took a look at the links mentioned,
and read all the PDFs and dived into
all the libraries.

There's no source, and no description
of the actual data traffic behind the
vendor-supplied API calls.

There is no handle to grab in hope of
sending your own BlueTooth traffic directly
from blocks.

ABG

Chris Ward

unread,
Mar 9, 2018, 1:09:32 PM3/9/18
to MIT App Inventor Forum
Hi Marijke

save the layout file locally  Save the file to the SD Card.

I would like to examine the VBA code but I do not have MS Office (I can examine the SpreadSheet) - can you save the VBA code to a seperate file and post it here?

AUV AUV

unread,
Mar 10, 2018, 4:08:56 AM3/10/18
to MIT App Inventor Forum
attached the VBA source code with a small description. This is used on windows, not on android.
sourcecode-VBA.docx

Chris Ward

unread,
Mar 10, 2018, 7:39:37 AM3/10/18
to MIT App Inventor Forum
Hi Marijke

Excuse my rambling, I'm just thinking out loud :)

It's very interesting to see the code - was it you that highlighted the Print Execution function definition? It's only a fraction of what is required.

There is a lot of code in there, much of which can be reverse engineered into App Inventor code and some of which can be ignored - for example, extracting the tape width sizes from available .lea files can be done with VBA in Excel as a one-off and the results used to define permanent AI Lists. However, launching (Activity Starter) the Epson Label Editor for Android might well be necessary for anything graphical. Portions of the code glean data from the Excel workbook. For text based labels you would have your own "label arrangement screen" which might be as simple as two or three Text Boxes.

A huge amount of work (though if you enjoy a challenge and are not in a race against time, should be a lot of fun), there is a gotcha in that the labels (CSV) are using UTF-16 and App Inventor uses UTF-8 - chalk and cheese! This means you would need a procedure that 'converts' your AI UTF-8 Strings to UTF-16 and that would be at byte level. An AI extension would be the way to go - Android Studio does do UTF-16, it's the native encoding of Java.

Conclusion: Doable, with copious amounts of coffee a necessity, but there would have to be a solid reason to do it (other than the joy of coding) given the challenge, time consumed and the probable lack of commercial viability, especially given the fact that Epson already provide an Android app. 





AUV AUV

unread,
Mar 10, 2018, 12:07:24 PM3/10/18
to MIT App Inventor Forum
Thanks you for your help. I now will start to make an own excel VBA example with my .lea layout file, so I can use the labelprinter on windows. Not what I want to have, but nice to make an example. 
I will look for another labelprinter with more possibilities on Android, eg. Dymo. Or do you have experience with other labelprinters ?
With kind regards, Marijke

Chris Ward

unread,
Mar 10, 2018, 7:17:46 PM3/10/18
to MIT App Inventor Forum
Hi Marijke

There seems to be less standardisation concerning Android printers than you find on Windows OS. It would of course be nice to have some print functionality in AI.

Here is a recent post about sending QR code to a POS printer:

AUV AUV

unread,
Mar 11, 2018, 4:39:30 AM3/11/18
to MIT App Inventor Forum
Thank you very much. I will do some further investigations.
With kind regards, Marijke

Abraham Getzler

unread,
Mar 11, 2018, 1:27:03 PM3/11/18
to MIT App Inventor Forum
There are a couple of Printing posts in the Printing

Let us know if they help.

ABG

AUV AUV

unread,
Mar 18, 2018, 3:32:44 AM3/18/18
to MIT App Inventor Forum
I made an excel VBA example, this works fine now. In windows you have a layoutfile ( .lea ) made with the epson label editor program and a csv file with some data to print. The minimum print command is :

LabelEditor.exe /p  <layoutfile.lea>,<datafile.csv>,<nr of copies>


I found an example in Java that is doing the same in Android, see attached. In yellow I marked the print command part. My question is, can something like this done in AI2 with the activity starter ? I really like to make something in AI2.


With kind regards, Marijke

Java-example-for-android.docx

Chris Ward

unread,
Mar 18, 2018, 9:40:24 AM3/18/18
to MIT App Inventor Forum
Hi Marijke

I have little free time at the moment so I can't study it - but if can be done in Java, that might mean it can be done in Javascript, which would mean you could make an HTML page to work inside your app. Utopia.......

Ghica

unread,
Mar 18, 2018, 1:05:46 PM3/18/18
to MIT App Inventor Forum
I think your best bet would be to find an App Inventor expert who can turn your Java into an extension. There are some that can do this for a fee. Or become an expert yourself!
Cheers, Ghica.

AUV AUV

unread,
Mar 20, 2018, 8:54:12 AM3/20/18
to MIT App Inventor Forum
I do not understand the html solution, either I do not know how to make a Java script to use within AI2. Do you know somebody who could help me ? What will be the cost ?
With kind  regards, Marijke

Chris Ward

unread,
Mar 20, 2018, 5:23:11 PM3/20/18
to MIT App Inventor Forum
Hi Marijke

The best analogy of what a browser-based application can do would be AI itself :)

For your requirements, there is not really any short-cut solutions. Somebody might be willing to turn the Java code you have into an AI extension but because it is specific to one printing device, it not an attractive proposition unless you want to fork-out some serious money for an exclusive extension. It also has a degree of complexity, so a major update of AI might require an update of the extension in the future.

Do you understand the JAVA code you have? If you do, then you should be able to either write your own AI extension or 'convert' the Java code into JavaScript as an HTML page solution. There are text-based programming languages out there that are based on the BASIC language and produce a JavaScript result, either for Android as a complete app or as a web solution that could form part of an Android app via a web page viewing component (Like AI's).

Ghica

unread,
Mar 20, 2018, 5:25:48 PM3/20/18
to MIT App Inventor Forum
Hallo Marijke,
I looked at the documentation for this printer and I think that neither a HTML solution nor an an extension is feasible or even possible.
There is however an Android app for this printer and maybe you can use it via the Activity starter. I have not enough experience with that but there is lots of information on this forum on how to use the activity starter to start other apps.

It is for you to find out what this app would need from information you created in App Inventor. So far that is not very clear to me.

There are .csv files that contain data to be printed using a certain layout in a layout file. What is the App Inventor app going to provide?
As I do not want to pollute my phone with all kinds of apps, I do not want to download the Epson iLabel app, but you can and you can experiment with it.
Cheers, Ghica

Reply all
Reply to author
Forward
0 new messages