giorgiofellipe / cordova-plugin-datecs-printer Goto Github PK
View Code? Open in Web Editor NEWCordova plugin to print on Mobile Bluetooth ESC/POS Printers - Tested on Datecs DPP-250 Printer
License: MIT License
Cordova plugin to print on Mobile Bluetooth ESC/POS Printers - Tested on Datecs DPP-250 Printer
License: MIT License
Olá. Tem alguma página com tutorial ou exemplos de como usar o plugin para impressão no cordova com impressora datecs?
This plugin work on TM P80 Epson already tested!!!
Thanks
The build fails after the recent update:
on config.xml:
<gap:plugin source="npm" name="cordova-plugin-datecs-printer" />
Phonegap Build (Android) shows:
"Error - Some official plugins have to be updated if using PhoneGap >= 4.0.0. Please upgrade the version of any plugins that may include the following file: DatecsPrinter.java"
This plugin works fine. Thank george. I'm using: 58mm thermal printer. I'm interested to know the other compatible models. what are your printers?
Hi, I'm getting this problem when I'm trying build my app. I have all extras installed in sdk manager.
Error: cmd: Command failed with exit code 1 Error output:
C:\Users\alan.araujo.NT\Desktop\fxd-mobile\platforms\android\src\com\giorgiofellipe\datecsprinter\DatecsSDKWrapper.java:36: error: package android.support.v4.content does not exist
import android.support.v4.content.LocalBroadcastManager;
^
C:\Users\alan.araujo.NT\Desktop\fxd-mobile\platforms\android\src\com\giorgiofellipe\datecsprinter\DatecsSDKWrapper.java:646: error: cannot find symbol
LocalBroadcastManager.getInstance(mWebView.getContext()).sendBroadcastSync(intent);
^
symbol: variable LocalBroadcastManager
location: class DatecsSDKWrapper
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors
FAILURE: Build failed with an exception.
Compilation failed; see the compiler error output for details.
@giorgiofellipe Estou tentando imprimir imagens e descobri que tem varias maneiras de mandar imagens.
I have image url
var imageBase2 = canvas.toDataURL('image/png');
var image1 = new Image();
image1.src =imageBase2;
How to print image URL by this plugin?, I already print but the result missing some data
I'm trying to display a text aligned to the left and aligned to right on the same line.
The "|" character is the paper limit.
Something like this:
| XXXX YYYY |
Everytime I try to print, the text is aligned everything to right or left, like:
| XXXXYYYY |
Is it possible to print on same line with 2 alignments? Can you send an example?
Hey Giorgio, I installed your awesome plugin on an Ionic 2 project, I am pretty sure it is well installed, but I don't know why it is not working, it is happening either the methods are not being called or are being called but doing nothing, I am calling the methods this way:
( < window > ).DatecsPrinter.listBluetoothDevices(.....)
estou com problema no connect, mesmo a impressora não estando ligada na hora do connect, o callback error nunca é chamado, poderia me ajudar?
Hi,
I'm getting the following error when I invoke print function for text
{"errorCode":5,"message":"Error printing","exception":"Broken pipe"}
This my print code
function printSomeTestText() {
window.DatecsPrinter.printText("Print Test!", 'ISO-8859-1',
function() {
alert('print success')
},
function(error) {
console.log(JSON.stringify(error));
}
);
}
Any plans to support IOS?
Thank you Giorgio Fellipe!! Your plugin worked like a charm for Bixolon SPP-R210 thermal printer and your ionic service saved me a hell lot of time. I owe you a beer mate! :)
I'm considering a full refactor to rename this as a generic ESC/POS thermal printers plugin.
Help is welcome 😄
There are the problem when i print For example, Ả ả Ã ã Ạ ạ Ắ ắ Ằ ằ Ẻ ẻ Ẽ ẽ Ẹ ẹ Ế ế Ề ề Ể ể Ễ ễ Ệ ệ, etc.
but the result when i print is A a A a A a A a E e E e E.
So I want the result like Ả ả Ã ã Ạ ạ Ắ ắ Ằ ằ Ẻ ẻ Ẽ ẽ Ẹ ẹ Ế ế Ề ề Ể ể Ễ . How t solve it. I use print image method.
when use myImage.arc='img/test.png' it is working but I don't want to save image before print. i want to convert to basse64 and print it,
My code bellow:
function printMyImage() {
var imagedata;
html2canvas([document.getElementById('mainDiv')], {
background:'#fff',
onrendered: function (canvas) {
imagedata = canvas.toDataURL('image/png');
// imagedata = canvas.toDataURL();
var myImage = new Image();
myImage.src = imagedata;
myImage.onload = function () {
var canvas = document.createElement("canvas");
canvas.height = 300;
canvas.width = 200;
var context = canvas.getContext('2d');
context.drawImage(myImage, 0, 0);
// var imageBase = canvas.toDataURL('image/png').replace(/^data:image\/(png|jpg|jpeg);base64,/, "");
var imageBase = canvas.toDataURL('image/jpeg').replace(/^data:image\/(png|jpg|jpeg);base64,/, "");
//var imageBase=canvas.toDataURL("image/png").replace("image/png", "image/octet-stream");
window.DatecsPrinter.printImage(
imageBase, //base64
canvas.width,
canvas.height,
1,
function () {
//printMyBarcode();
},
function (error) {
alert(JSON.stringify(error));
}
)
}
}
})
}
Broadcast to JavaScript how the device's connection with the printer is going, if it was lost, if it was connected, reconnected, etc.
Boa tarde, Giorgio. Tudo bem? Estou com problemas aleatórios na impressão. Trabalho com impressão de fichas. Imprimo várias fichas por vez, de diferentes itens. Cada ficha é composta por apenas um conjunto de textos, esses com fontes menores e fontes maiores. Imprimo as fichas sem problemas e perfeitamente. Em algumas combinações de fichas, a impressora começa a imprimir e, de repente, no meio da impressão, a impressora para de imprimir e perde o pareamento com o aplicativo, mantendo apenas o pareamento com o tablet. Ou seja, ela para de imprimir no meio da impressão e a luz azul da impressora Datecs para de imprimir. Isso só acontece em algumas ocasiões e não existe um padrão para acontecer. Já viu algo parecido? Sabe como resolver isso ou debugar o problema com código de erros? Já testei com várias impressoras diferentes e vários tablets/celulares android e o erro continua. Acontece raramente mas acontece. Será que existe um bug relacionado a isso? Obrigado.
Create a list of code errors and messages, to organize them
Good work Giorgio,
I am Spanish and we have the problem of accents when sending a text to the printer, I already tried UTF-8 and ISO-8859-1, but it prints badly. Is there any way to send encoded and to print the accents correctly?
Thanks!
@douglasjunior Esse é o código de impressão que eu tinha comentado na aula
We are having trouble trying to establish it using a Bixolon printer. Could you assist us on this? Thank you!
Giorgio eu vi que o driver possui impressão de QR Codes mas você não implementou o método, tentei implementar mas não funcionou na impressora que tenho, você chegou a tentar usar?
Estou imprimindo como imagem mas fica bem lenta a impressão, mesmo num tamanho pequeno 1,5cm x 1,5cm.
Hi,
I can print to bluetooth printer with cordova,ionic mobile application,
barcode or text is no problem,
I can print HPRT MPR-III,
but I can not print barcode with HPRT MLP-2 (I can print text MLP-2 but can not barcode),
I received "ok" message but dont print,
What do you think about that problem?
(my test phone is samsung note 5)
@giorgiofellipe estou com dúvidas e problemas em relação a escuta dos aparelhos com o broadcaster.
Segundo suas instruções para cordova:
window.broadcaster.addEventListener( "DatecsPrinter.connectionStatus", function(e) {
if (e.isConnected) {
//do something
}
});
Porém para o ionic, eu coloquei:
$window.broadcaster.addEventListener( "DatecsPrinter.connectionStatus", function(e) {
if (e.isConnected) {
//do something
}
});
Porém, quando coloco essa parte no ionic, depois de ter instalado o seu plugin e o plugin do cordova broadcaster, da o seguinte erro:
TypeError: Cannot read property 'addEventListener' of undefined
Poderia me dar um help?
Grato!!!!!
-I have download cordova-plugin-datecsprinter-example-master and run it, but I got the error $window.DatecsPrinter is undefined.
I already installed plugin cordova-plugin-datecs-printer.
-How to solved it?.
-when I add the code on this website to my ionic project, it has the same problem 'window.DatecsPrinter is undefined'.
Help me please.
Help me please, I have designed a recipe in html but how to print it by this plugin?
I need to print more character(now 28 characters / each line) and also formatting some style(reduce font size) while printing. Tag defination {s}, {/s} not supported in INTEL XDK.
Giorgio, o plugin parou de funcionar no intelXDK, até 2 dias atrás estava funcionado perfeitamente, estou testando o plugin e hoje não estou mais conseguindo fazer o build, voce fez algumas alterações nos ultimos dias ?
I use below code to print barcode but nothing print. Not show any error. I already test with text it is work.
What am i wrong . Thnaks!
DatecsPrinter.listBluetoothDevices()
.then(function (addresses) {
return DatecsPrinter.connect(addresses[0]);
})
.then(function (success) {
return DatecsPrinter.printBarcode(75, '13132498746313210584982011487');
})
.then(function (success) {
return DatecsPrinter.disconnect();
})
.catch(function (error) {
alert(JSON.stringify(error));
});
Hi, i'm trying to print an image, but i don't know how it works properly, can you help me with some example? I'm doing this with simple javascript
Hola, estoy tratando de imprimir una imagen pero no se como hacerlo funcionar, puedes ayudarme con algún ejemplo de como implementarlo? Estoy usando solamente Javascript
Pd: si no hablas ingles, puedes contestarme en español o portugués que yo puedo entender algo.
Implement responses to callbackContext with error codes (#1)
Also implement something like a method setToastsEnabled(boolean)
Hello,
The plugin not working on Android 4.1.2.
Any suggestion ?
Thank you.
Hi brother! it's me again haha, sorry.
I'm trying to print some characters in spanish as " ñ " and vowels like " á é í ó ú" with accent. Which econding type accepts your plugin for this? ISO-8859-1 doesn't print that characters...
Thanks and sorry one more time.
I never had a problem centering the image in the center, with code 1, through the function:
.....
window.DatecsPrinter.printImage(
imageData, //base64
canvas.width,
canvas.height,
1,
......
Now the image is aligned to the left.
Congratulations on the plugin.
Hello
I have tried your plugin, printer allow 28 character / each line. But i need to reduce the font size and print the more character in single line. I have tried {h},{s},{w} tag but there is no change. Kindly guide me how to reduce it . {center}tag also not working , {br} only allowed. My bluetooth printer model is "ANALOGICS" and model number is "AET36015". My code is
window.DatecsPrinter.printText("{b}{center}TEST HEADING{/b}{br}");
Como utilizar a função selectStandardMode;
gostaria de ter exemplo de como mandar os seguintes dados (align, small, scale, hri, height) eu não sei como mandar o hri monta um exemplo
Teria como colocar comandos POS / ESC para ir direto para a impressora?
Ex: 1B 61 01 para centralizar, 1D 68 50 para altura do código de barras, etc...
Digo isso pois gostaria de personalizar os textos logo após a logo e não consigo aqui.
Olá, primeiramente, parabéns pela contribuição. Estou trabalhando com impressoras datecs também e queria saber se esse plugin que desenvolveu para o cordova consegue recuperar em tempo real e de forma imediata o status "real" da impressora. Estou usando recentemente um plugin cordova para conexões bluetooth onde utilizo o método isConnected() para checar se a impressora está conectada ao dispositivo. Ele funciona bem, mas se eu desligar a impressora e imeditamente chamar esse método isConnected() ele continua retornando que a impressora está conectada. Somente após aproximadamente 5 segundos que este método começa a retornar que a impressora está desconectada. Ou seja, o plugin que uso tem aproximadamente um delay de 5 segundos para atualizar o status da impressora. Gostaria de saber se o plugin que você desenvolveu também tem este problema. Desde já, muito obrigado!
The documentation says printImage function does not resize image but when i use it, image is always resized, even if i specify the exact width and height in the parameters
Can i get the example code for Tags definition?
Make possible to choose between flush on every command or call it separately
Hi, I've created a phonegap app and I'm trying to run it with the phonegap desktop but when I run it in my device it does nothing. Do I have to create the apk and install it for the plugin to work?
Thanks!
Can this plugin work with EPSON Thermal printers? if so any specific model?
Hello, is there a way for the developer to handle unexpected errors such as:
-When the printer turns off during the printing process.
-When printer runs out of paper
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.