Je ne peux pas imprimer plus de 380 caractères dans un code qr.EPSON ESCPOS QRCode> 380 caractères non imprimés
suit le code en C#:
protected ASCIIEncoding m_encoding = new ASCIIEncoding();
string QRdata = @"35150909165024000175590000193130072726117830|20150924062259|50.00||hdMEPiER6rjZKyKA+4+voi1nncxsAGFbYsEEqnh04SbvUEI/haUF4GUBPxT6Q2Uhf9f8QYgxiwxWo3GxRrvj4WnNeTYgAqUAYmOANPItNkOw0CppmZ4R8i1ZOlnftVhksCM0zrl4RiKgoazbN44hUu2nQf0W/JLvFXzXu12JlcSThNtmyJ6m9WBsMc/sf9BE14HDoXMyKRIQYt5TkEjilHH9Ffa0saRyUIp+Fji89/Moq8YCCFC+qC44XGxsvNCeeHUNOc1LgPP0DbU1miwpVnrBlEl87RU8Iy0r8fN/fNhbcStkwfTEvhYvZz42nEKHrmGTpGZYkHuTFCNZPq7aCA==";
int store_len = QRdata.Length + 3;
byte store_pL = (byte)(store_len % 256);
byte store_pH = (byte)(store_len/256);
string txt = m_encoding.GetString(new byte[] { 29, 40, 107, store_pL, store_pH, 49, 80, 48 }); //FUNCTION 180
txt += QRdata;
txt += m_encoding.GetString(new byte[] { 29, 40, 107, 3, 0, 49, 69, 48 });//FUNCTION 169
txt += m_encoding.GetString(new byte[] { 29, 40, 107, 3, 0, 49, 67, 5 });//FUNCTION 167
txt += m_encoding.GetString(new byte[] { 29, 40, 107, 4, 0, 49, 65, 50, 0 });//FUNCTION 165
txt += m_encoding.GetString(new byte[] { 29, 40, 107, 3, 0, 49, 81, 48 });//FUNCTION 181
Lorsque vous essayez d'imprimer apparaît comme suit:
Montrez, s'il vous plaît, comment utilisez-vous la chaîne? Si je comprends bien, vous l'envoyez au port série. Pourquoi n'utilisez-vous pas le tableau d'octets alors? Il semble que l'ASCII soit votre problème, car il s'agit d'un codage 7 bits, mais votre partie basse de longueur dépasse 7 bits, donc vous obtenez '?' Dans la variable 'txt'. Vous pouvez utiliser 'Encoding m_encoding = Encoding.GetEncoding (" iso-8859-1 ");' et définir le même encodage pour le port série, ou utiliser le tableau d'octets depuis le début. BTW, pouvez-vous essayer d'imprimer le code QR avec votre code actuel pour le texte ayant une longueur comprise entre 128 et 255? –
J'utilise Winspool pour imprimer. J'ai changé mon code pour envoyer un octet au winspool avec cet encodage et cela a fonctionné parfaitement. Avant d'imprimer jusqu'à 380 caractères. Maintenant, cela a fonctionné, merci beaucoup pour votre aide! –
Heureux que cela a aidé, j'ai posté une réponse au cas où quelqu'un chercherait le même problème. –