giorgiofellipe / cordova-plugin-datecs-printer

Cordova plugin to print on Mobile Bluetooth ESC/POS Printers - Tested on Datecs DPP-250 Printer
MIT License
73 stars 60 forks source link

How to print Tamil Characters using this plugin methods #104

Open Gunasekaran15 opened 6 years ago

Gunasekaran15 commented 6 years ago

img_20180404_164807 How to print Tamil Characters using this plugin methods,Please Provide the method name and examples to print this characters.sample copy of printed data

my code for printing tamil char:

var a='தமிழ் மேல் ஆர்வமுடையவர்கள் தாங்கள் விரும்பும் தலைப்புகளில் கட்டுரைகளை எழுதி எழுத்து.காம் ல் சமர்பிக்கலாம்'; window.DatecsPrinter.write(a,'UTF-8',

              function() {
                alert(a);
                       },

                   );

Plese provide the solution for this as soon as possible.

rhiroshi commented 6 years ago

is your code using utf-8 encoding too?

Gunasekaran15 commented 6 years ago

without utf-8 it prints symbols,with utf-8 it print like in the above image

rhiroshi commented 6 years ago

I'm not sure it will help but i think your .js files must be utf-8 aswell so it matches the encoding you are passing to the datecs plugin. In atom you should be able to find your file encoding at the footer (see image) sem titulo

Gunasekaran15 commented 6 years ago

uft Yes it is utf-8.

I think the plug in function change the characters to symbols,I also try to print chinese characters using their encoding standard GB 18030 but it prints symbols.Is there any way to print what we give in the printText function that print that exact text without using encoding and any other methods

rhiroshi commented 6 years ago

This plugins uses the api method that passes a charset encoding, using the ISO-8859-1 as default. You could edit the plugin so it uses the method that doesn't pass the charset. It will use a default encoding (maybe the system default?). As it is in the api's documentation: public void printTaggedText(java.lang.String s) throws java.io.IOException

Prints a tagged text using default charset for encoding. The text is encode into a sequence of bytes using the default charset encoding.

the plugin file that uses the overriden method (public void printTaggedText(java.lang.String s, java.lang.String encoding) is at cordova-plugin-datecs-printer\src\android\DatecsPrinter.java line 76.

Gunasekaran15 commented 6 years ago

But we change the charset and that data sent to the printer using window.DatecsPrinter.printText('text','charset'). I change the charset as utf8 in this method.

Gunasekaran15 commented 6 years ago

If we change the charset as utf8 default.It prints what we give in printText() method or not.

rhiroshi commented 6 years ago

it only uses ISO-8859-1 if you dont specify what charset you want (eg: printText('text');)

Gunasekaran15 commented 6 years ago

If we specify the particular charset it takes that charset or not.

why we can't change that particular charset as UTF-8.

rhiroshi commented 6 years ago

Yes. The plugin is using the following Datecs API method: public void printTaggedText(java.lang.String s, java.lang.String encoding) throws java.io.IOException

Prints a tagged text using the named charset for encoding. The text is encode into a sequence of bytes using the given charset. If s if null, a NullPointerException is thrown. Parameters: s - the tagged text to print. encoding - the name of a supported charset.

Gunasekaran15 commented 6 years ago

Please provide the guideline to change supported charset to print tamil language.

rhiroshi commented 6 years ago

So i tried printing those characteres here too but didn't work. I guess you should email Datecs asking which charsets are supported since it goes straight to their api.

kavinRkz commented 6 years ago

I am also facing the issues on tamil characters..i m getting like this ?????????..anyone find the solution for tamil language.

nok32 commented 6 years ago

Any solution?

kavinRkz commented 6 years ago

try to convert hex decimal values into byte array its working for tamil printing but styles are not supported ...

csleeds commented 5 years ago

trigger a printer self test, it should trigger a printing of current printer's detail showing which codepage been set.

If the current codepage doesn't support the character you want to print, you need to find the relevant printer's setting tool to set the codepage first. you may do so by start looking at the printer manufacturer's website download page.