|
PROFESSIONAL NEWSGROUPS WINDEV, WEBDEV and WINDEV Mobile |
| | | | | |
Home → WINDEV 25 → WM - Imprimindo usando Windev Mobile em uma Impressora Bluetooth |
WM - Imprimindo usando Windev Mobile em uma Impressora Bluetooth |
Started by BOLLER ADRIANO, Jun., 27 2016 10:55 PM - 8 replies |
| |
| | | |
|
| |
Registered member 3,657 messages Popularité : +175 (223 votes) |
|
Posted on June, 27 2016 - 10:55 PM |
Prezados,
Segue exemplo de como imprimir usando Windev Mobile em uma Impressora Bluetooth e serve também para Impressora ZEBRA deve ter suporte TSPL/TSPL2 com linguagem zpl.
Esse exemplo foi enviado por: Marcos Ríos Skype ID: trionika Arequipa, Arequipa, Peru
TELA:
Procedure texto_imprimir() sCadena is string IF NoSpace(EDT_Texto)="" THEN sCadena = [ CODEPAGE 8859-1 SPEED 4 SIZE 4,1 GAP 0,0 DIRECTION 0 CLS TEXT 80,20,"2",0,1,1,1,"ALIMENTOS PROCESADOS S.A." TEXT 75,35,"2",0,1,1,1,"-----------------------------------" PDF417 80,50,400,400,0,E4,"B9idg1tcbOYOSYwWglmS/v5CoiQ=" PRINT 1,1 CLS ]; ELSE sCadena = EDT_Texto; END RESULT sCadena
Procedure Global JAVA:
import android.util.Log; import android.app.Activity; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothSocket; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.view.View; import android.widget.TextView; import android.widget.EditText; import android.widget.Button; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Set; import java.util.UUID;
PUBLIC static void imprime_texto() { BluetoothAdapter mBluetoothAdapter; BluetoothSocket mmSocket; BluetoothDevice mmDevice; OutputStream mmOutputStream; InputStream mmInputStream; Thread workerThread; byte[] readBuffer; int readBufferPosition; int counter; string impresora; impresora = ""; try { mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices(); IF (pairedDevices.size() > 0) { impresora = "BT-TEST"; for (BluetoothDevice device : pairedDevices) { IF (device.getName().equals(impresora)) { mmDevice = device; UUID uuid = UUID.fromString("00001101-0000-1000-8000-00805f9b34fb"); mmSocket = mmDevice.createRfcommSocketToServiceRecord(uuid); mmSocket.connect(); mmOutputStream = mmSocket.getOutputStream(); mmInputStream = mmSocket.getInputStream(); string msg = callWLProcedure_String("texto_imprimir"); msg += "\n"; mmOutputStream.write(msg.getBytes()); mmOutputStream.close(); mmInputStream.close(); mmSocket.close(); BREAK; } } } } catch (NullPointerException e) { e.printStackTrace(); } catch (EXCEPTION e) { e.printStackTrace(); } }
BOTÃO IMPRIMIR:
imprime_texto()
Link para aquisição da Impressora:
http://www.aliexpress.com/snapshot/7823102237.html…
Fontes:
http://depot.pcsoft.fr/publish.awp…
REQUISITO: Windev Mobile 21
Esse exemplo foi enviado por: Marcos Ríos Skype ID: trionika Arequipa, Arequipa, Peru
-- Adriano José Boller ______________________________________________ Consultor e Representante Oficial da PcSoft no Brasil +55 (41) 9949 1800 adrianoboller@gmail.com skype: adrianoboller http://wxinformatica.com.br/Message modified, June, 27 2016 - 11:22 PM |
| |
| |
| | | |
|
| | |
| |
Registered member 3,657 messages Popularité : +175 (223 votes) |
|
Posted on June, 27 2016 - 11:35 PM |
| |
| |
| | | |
|
| | |
| |
Registered member 4 messages |
|
Posted on November, 26 2017 - 1:03 PM |
Bonjour Monsieur J'ai intégré votre code pour pouvoir tester mon imprimante M58 mais j'ai cette erreur lors de la génération de mon sdk sous windev mobile.Merci de me preciser l'erreur s'il vous plait.
Echec de la création de l'application Android <C:\Mes Projets Mobile\ImprimanteBluetooth\Exe\ImprimanteBluetooth.apk>.
Ligne de commande : "C:\Program Files\Java\jdk1.8.0_144\bin\javac.exe" -encoding UTF-8 -nowarn -source 1.5 -target 1.5 -d bin\classes -bootclasspath "C:\Program Files (x86)\Android\android-sdk\platforms\android-26\android.jar" gen\com\masociete\imprimantebluetooth\*.java src\com\masociete\imprimantebluetooth\wdgen\*.java -classpath "libs;bin\classes;libs\android-support-v4.jar"
Erreur retournée : src\com\masociete\imprimantebluetooth\wdgen\GWDCPCOL_ImpressionBluetooth.java:66: error: ';' expected IF (pairedDevices.size() > 0) { ^ src\com\masociete\imprimantebluetooth\wdgen\GWDCPCOL_ImpressionBluetooth.java:70: error: ';' expected IF (device.getName().equals(impresora)) { ^ src\com\masociete\imprimantebluetooth\wdgen\GWDCPCOL_ImpressionBluetooth.java:84: error: not a statement BREAK; ^ 3 errors |
| |
| |
| | | |
|
| | |
| |
Registered member 3,657 messages Popularité : +175 (223 votes) |
|
Posted on November, 27 2017 - 12:28 AM |
Bonjour
Erros são devido voce usar maiusculo o Java é Case Sensitve, mude de maiusculo para minusculo o IF para if e o BREAK para break que vai dar certo.
Errors are due you to use uppercase Java is Case Sensitve, change from minus to IF to IF and BREAK to break that will work.
OK
-- Adriano José Boller ______________________________________________ Consultor e Representante Oficial da PcSoft no Brasil +55 (41) 99949 1800 adrianoboller@gmail.com skype: adrianoboller http://wxinformatica.com.br/ |
| |
| |
| | | |
|
| | |
| |
Registered member 4 messages |
|
Posted on February, 12 2018 - 7:28 PM |
Bonjour Monsieur
Comme vous l'avez dit j'ai revu les casses de mes caractères et je n'ai plus d'erreurs de generation.
Mais par contre je viens de prendre une imprimante Bluetooth RPP 200,quand je teste sur mon téléphone après génération de mon apk l'imprimante ne réagit pas.
Merci de me donner un coup de main,vraiment urgent!!!
// Résumé : // Syntaxe : // imprimer_texte () // // Paramètres : // Aucun // Valeur de retour : // Aucune // // Exemple : // Indiquez ici un exemple d'utilisation. // //PROCEDURE imprimer_texte() // //
import android.util.Log; import android.app.Activity; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothSocket; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.view.View; import android.widget.TextView; import android.widget.EditText; import android.widget.Button; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Set; import java.util.UUID;
public static void imprimer_texte() { // android built in classes for bluetooth operations BluetoothAdapter mBluetoothAdapter; BluetoothSocket mmSocket; BluetoothDevice mmDevice; OutputStream mmOutputStream; InputStream mmInputStream; Thread workerThread; byte[] readBuffer; int readBufferPosition; int counter; String impresora; impresora = ""; try { mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); Set pairedDevices = mBluetoothAdapter.getBondedDevices(); if (pairedDevices.size() > 0) { impresora = "RPP200-E"; for (BluetoothDevice device : pairedDevices) { if (device.getName().equals(impresora)) { mmDevice = device; UUID uuid = UUID.fromString("00;0E;0E;14;20;4A"); mmSocket = mmDevice.createRfcommSocketToServiceRecord(uuid); mmSocket.connect(); mmOutputStream = mmSocket.getOutputStream(); mmInputStream = mmSocket.getInputStream(); String msg = callWLProcedure_String("impression_texte"); msg += "\n"; mmOutputStream.write(msg.getBytes()); mmOutputStream.close(); mmInputStream.close(); mmSocket.close(); break; } } } } catch (NullPointerException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } |
| |
| |
| | | |
|
| | |
| |
Registered member 3 messages |
|
Posted on March, 31 2019 - 11:40 PM |
Bonjour, auriez-vous une idée pour imprimer en utilisant ce type d'équipement. TPE android avec Imprimante intégrée Merci
-- ------------------------------------------------------------------------------------------------------ Le savoir partagé est un enrichissement personnel ! |
| |
| |
| | | |
|
| | |
| |
Posted on July, 19 2019 - 6:22 PM |
Bonjour ,svp j'aimerais imprimer sur mon imprimante Zebra ZQ520 à partir de windev mobile quelqu'un peut m'aider pour le code |
| |
| |
| | | |
|
| | |
| |
Registered member 3,657 messages Popularité : +175 (223 votes) |
|
Posted on July, 22 2019 - 4:20 PM |
VIDEO
Example CODE
https://repository.windev.com/resource.awp?file_id=281474976710839;integrando-mini-impressora-termica-xing-ling-com-projeto-feito-com-windev-mobile
-- Adriano José Boller ______________________________________________ Consultor e Representante Oficial da PcSoft no Brasil +55 (41) 99949 1800 adrianoboller@gmail.com skype: adrianoboller http://wxinformatica.com.br/ |
| |
| |
| | | |
|
| | |
| |
Registered member 217 messages Popularité : +12 (12 votes) |
|
Posted on October, 11 2020 - 10:44 AM |
Hi First, thanks for this share. It work verry well for me. I would like to know if it is possible to print images instead of texte using java. Do you have any java method that print image ? |
| |
| |
| | | |
|
| | | | |
| | |
| | |
| |
|
|
|