|
FORUMS PROFESSIONNELS WINDEV, WEBDEV et WINDEV Mobile |
| | | | | |
Accueil → WINDEV 25 → WM - Imprimindo usando Windev Mobile em uma Impressora Bluetooth |
WM - Imprimindo usando Windev Mobile em uma Impressora Bluetooth |
Débuté par BOLLER ADRIANO, 27 juin 2016 22:55 - 8 réponses |
| |
| | | |
|
| |
Membre enregistré 3 657 messages Popularité : +175 (223 votes) |
|
Posté le 27 juin 2016 - 22:55 |
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 modifié, 27 juin 2016 - 23:22 |
| |
| |
| | | |
|
| | |
| |
Membre enregistré 3 657 messages Popularité : +175 (223 votes) |
|
Posté le 27 juin 2016 - 23:35 |
| |
| |
| | | |
|
| | |
| |
Membre enregistré 4 messages |
|
Posté le 26 novembre 2017 - 13:03 |
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 |
| |
| |
| | | |
|
| | |
| |
Membre enregistré 3 657 messages Popularité : +175 (223 votes) |
|
Posté le 27 novembre 2017 - 00:28 |
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/ |
| |
| |
| | | |
|
| | |
| |
Membre enregistré 4 messages |
|
Posté le 12 février 2018 - 19:28 |
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(); } } |
| |
| |
| | | |
|
| | |
| |
Membre enregistré 3 messages |
|
Posté le 31 mars 2019 - 23:40 |
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 ! |
| |
| |
| | | |
|
| | |
| |
Posté le 19 juillet 2019 - 18:22 |
Bonjour ,svp j'aimerais imprimer sur mon imprimante Zebra ZQ520 à partir de windev mobile quelqu'un peut m'aider pour le code |
| |
| |
| | | |
|
| | |
| |
Membre enregistré 3 657 messages Popularité : +175 (223 votes) |
|
Posté le 22 juillet 2019 - 16:20 |
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/ |
| |
| |
| | | |
|
| | |
| |
Membre enregistré 217 messages Popularité : +12 (12 votes) |
|
Posté le 11 octobre 2020 - 10:44 |
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 ? |
| |
| |
| | | |
|
| | | | |
| | |
| | |
| |
|
|
|