PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV Mobile 2024 → Imprimer sur imprimante BIXOLON
Imprimer sur imprimante BIXOLON
Débuté par FredAL, 01 mar. 2019 11:47 - 3 réponses
Membre enregistré
4 messages
Posté le 01 mars 2019 - 11:47
Bonjour,
J'essaie d'imprimer depuis une application Windev mobile sur une imprimante Bixolon, en utilisant les API fournis par Bixolon notamment en utilisant le code exemple suivant pour imprimer une image :


import com.bxl.config.editor.BXLConfigLoader;
import jpos.config.JposEntry;
import jpos.POSPrinter;
import jpos.POSPrinterConst;

public static void Enreg()
{
try
{
// BXLConfigLoader creating / setting file open
BXLConfigLoader bxlConfigLoader = new BXLConfigLoader(this);
bxlConfigLoader.openFile();
}
catch(JposException e)
{
e.printStackTrace();
bxlConfigLoader.newFile();
}
try
{
// Adding device information
bxlConfigLoader.addEntry("SPP-R200III",
BXLConfigLoader.DEVICE_CATEGORY_POS_PRINTER,
BXLConfigLoader.PRODUCT_NAME_SPP_R200III,
BXLConfigLoader.DEVICE_BUS_BLUETOOTH,
"74:F0:7D:E4:11:AF");
// Saving setting file
bxlConfigLoader.saveFile();
// print Open/Claim/DeviceEnabled
POSPrinter posPrinter = new POSPrinter(this);
posPrinter.open(“SPP-R200III”);
posPrinter.claim(5000);
posPrinter.setDeviceEnabled(true);
// image print
ByteBuffer buffer = ByteBuffer.allocate(4);
buffer.put((byte) POSPrinterConst.PTR_S_RECEIPT);
buffer.put((byte) 80); // brightness
buffer.put((byte) 0x01); // compress
buffer.put((byte) 0x00);
posPrinter.printBitmap(buffer.getInt(0),
“/storage/emulated/0/kicc/sample_image.png”,
384,
POSPrinterConst.PTR_BM_LEFT);
posPrinter.close();
}
catch(JposException e)
{
e.printStackTrace();
}
}

Mais ça ne fonctionne pas, le compilateur java indique de multiples erreurs, je ne vois pas comment faire.

Merci d'avance pour votre réponse
Membre enregistré
945 messages
Popularité : +102 (110 votes)
Posté le 01 mars 2019 - 15:37
Bonjour
Il aurait été très utile de nous donner cette liste d'erreur...
Membre enregistré
4 messages
Posté le 04 mars 2019 - 15:46
Bonjour,
Je précise que j'ai récupéré le code "Image print", code fourni par BIXOLON, j'ai juste ajouté "public static void Enreg()", à la compilation, j'ai de multiples messages d'erreur :

Erreur retournée :

:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
C:\Mes Projets Mobile\INFELECT\Android\Generation\src\com\masociete\infelect\wdgen\GWDCPCOL_Pg_Java.java:185: error: non-static variable this cannot be referenced from a static context
BXLConfigLoader bxlConfigLoader = new BXLConfigLoader(this);
^
C:\Mes Projets Mobile\INFELECT\Android\Generation\src\com\masociete\infelect\wdgen\GWDCPCOL_Pg_Java.java:188: error: cannot find symbol
catch(JposException e)
^
symbol: class JposException
location: class GWDCPCOL_Pg_Java
C:\Mes Projets Mobile\INFELECT\Android\Generation\src\com\masociete\infelect\wdgen\GWDCPCOL_Pg_Java.java:191: error: cannot find symbol
bxlConfigLoader.newFile();
^
symbol: variable bxlConfigLoader
location: class GWDCPCOL_Pg_Java
C:\Mes Projets Mobile\INFELECT\Android\Generation\src\com\masociete\infelect\wdgen\GWDCPCOL_Pg_Java.java:196: error: cannot find symbol
bxlConfigLoader.addEntry("SPP-R200III",
^
symbol: variable bxlConfigLoader
location: class GWDCPCOL_Pg_Java
C:\Mes Projets Mobile\INFELECT\Android\Generation\src\com\masociete\infelect\wdgen\GWDCPCOL_Pg_Java.java:202: error: cannot find symbol
bxlConfigLoader.saveFile();
^
symbol: variable bxlConfigLoader
location: class GWDCPCOL_Pg_Java
C:\Mes Projets Mobile\INFELECT\Android\Generation\src\com\masociete\infelect\wdgen\GWDCPCOL_Pg_Java.java:204: error: non-static variable this cannot be referenced from a static context
POSPrinter posPrinter = new POSPrinter(this);
^
C:\Mes Projets Mobile\INFELECT\Android\Generation\src\com\masociete\infelect\wdgen\GWDCPCOL_Pg_Java.java:209: error: cannot find symbol
ByteBuffer buffer = ByteBuffer.allocate(4);
^
symbol: class ByteBuffer
location: class GWDCPCOL_Pg_Java
C:\Mes Projets Mobile\INFELECT\Android\Generation\src\com\masociete\infelect\wdgen\GWDCPCOL_Pg_Java.java:209: error: cannot find symbol
ByteBuffer buffer = ByteBuffer.allocate(4);
^
symbol: variable ByteBuffer
location: class GWDCPCOL_Pg_Java
C:\Mes Projets Mobile\INFELECT\Android\Generation\src\com\masociete\infelect\wdgen\GWDCPCOL_Pg_Java.java:220: error: cannot find symbol
catch(JposException e)
^
symbol: class JposException
location: class GWDCPCOL_Pg_Java

Merci d'avance.
Posté le 06 mars 2019 - 20:28
Bonjour
Il y a quelques mois j'ai eu un problème identique, des messages d'erreur alors que j'étais sûr de mon code,
J'ai appelé le ST PCSOFT qui m'a fait supprimer le dossier suivant :

TonCompteUser\AppData\Local\Temp\FRMK_Android_xxxxxFR

Si tu ne veux pas supprimer le dossier, renomme le ou sauvegarde le et recompile ton appli.
j'ai pu compiler sans aucune erreur
Problème de déphasage...
En espérant que ça serve.