srehanuddin / Cordova-Plugin-Bluetooth-Printer

A cordova plugin for bluetooth printer for android platform
103 stars 116 forks source link

Image printing #1

Open ivangutierrezr opened 8 years ago

ivangutierrezr commented 8 years ago

Hi, I'm developing a phonegap app with js and i need to print a logo and barcode. Are you working on this? or do you know any plugin that works and has image print support?

srehanuddin commented 8 years ago

Hi, thanks for showing interest in this plugin, right now this plugin unable to print image and barcode, but in 3 days i will implement image & barcode printing.

ivangutierrezr commented 8 years ago

Hi @srehanuddin thanks for your answer. I'll be waiting for this and for use it! I'll be aware.

ivangutierrezr commented 8 years ago

Hi @srehanuddin , have you worked in image printing?

ivangutierrezr commented 8 years ago

Hi @srehanuddin how are you? I would like to know if you've achieved something about image printing.

ahsan-ab commented 7 years ago

i need to know how to pass html ?

ahsan-ab commented 7 years ago

when i call BTPrinter.printPOSCommand "Uncaught "TypeError: Object 0C has no method 'apply'" & when i call BTPrinter.print its returned "TypeError: Object String to Print has no method 'apply'" guide me where am i wrong ?

srehanuddin commented 7 years ago

@ivangutierrezr , Implemented Image Printing.

srehanuddin commented 7 years ago

@ahsan-ab you can not pass html, you have to create image from html, then convert image into base64 string, then send it to printer

wonk4rol commented 7 years ago

@srehanuddin why print() printing unknown character? this is my base64 image string : var logo = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAR0AAAAyCAYAAABh5w8sAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBbl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iKmngPlizx0igIRghISOKlkMRLEQtviVGgonbRHusd6dX8YT/hWI7ouk5VF1YzYTkscAwnhWIhi6Iplpgasyua4uRZ3hWRI05VV62EEBjEAEVREFhBETmx1211X8iyZzU6RMdJq2BtKsks8Q6NDkEnOpySEwzN4OVvvWzWtgkTC9nSmYBBDKi6Cp3oEFih321z9zsl54cZlgz4Ij5kWDIyenw9OTnOnPyL/RcLBFYoMIiRPxQaypY1OVPkxAxZl7NHIiMl3qBXJITwsiZzAiswoEDF1TjFUAxp7Go0aIpWWZpVGYaJi5wYkzgpInFSn6zJreU55UN2wd4fiAX6qvKrrgWjQY/b7h6UVdmX58gjOtEhazLiahyqrkLVVaTbrtSECRMLyNIxYcKEifkAbarAhAkTJumYMGHCJB0TJkyYMEnHhAkTiw7/fwBBMN/kWuODzwAAAABJRU5ErkJggg==';

Thanks for your great plugin.

jakeb-cloud commented 7 years ago

@srehanuddin , Print image using base64 is not working. The output on the printer is like a special character.

Thanks

IMR707 commented 7 years ago

From what I see with logcat, it seems that the it does not fully take the base64 string when it goes to the plugin functions. Mine only took the base64 string halfway. Maybe something can be done to bypass the character limit for long base64 string. Edit : Weird. Even short base64 string shows the special characters output too.

shineirvin commented 7 years ago

@wonk4rol did you find the way to print image bro ? this is my output when im trying to print base64 15bf0060-1531-4907-a8d0-2f350b819f4b this is my base64 code http://pastebin.com/qU7XZ1Mn anyone know why ?

wonk4rol commented 7 years ago

@shineirvin i have not solved this issue :-(

CurvesTech commented 7 years ago

I am also getting gibberish when trying to print image.. has this been fixed yet?

pietervw commented 7 years ago

Hi guys, has anyone been able to print an image?

SudarVenkat commented 7 years ago

img_20170213_235506 img_20170213_235459

this is my output when im trying to print base64 please help me. i am ready to pay for them its very urgent please help me..

pietervw commented 7 years ago

I eventually got it working with this plugin.

SudarVenkat commented 7 years ago

Hi

thanks for this plugin i have tried this it saying BixolonPrint.printText failure: Printer not found error

please help me to fix this

this is my code.

var printerApp = angular.module('starter', ['ionic','ngCordova']); printerApp.run(function($ionicPlatform) { $ionicPlatform.ready(function() { if(window.cordova && window.cordova.plugins.Keyboard) { cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); cordova.plugins.Keyboard.disableScroll(true); } if(window.StatusBar) { StatusBar.styleDefault(); } /BTPrinter.list(function(data){ console.log("Success"); console.log(data); //list of printer in data array },function(err){ console.log("Error"); console.log(err); }); BTPrinter.connect(function(data){ console.log("Success"); console.log(data) },function(err){ console.log("Error"); console.log(err) }, "SILBT-920");/ //SILBT-920 //TM-P20_000075 cordova.plugins.bixolonPrint.settings = { lineFeed: 3, formFeed: false, // enable\disable jump to next position, in black marker and label modes autoConnect: true, // Android only: if this is set to false displays a dialog box for selecting the printer toastMessage: true, // Android only: show a printer message separator: '=', codePage: cordova.plugins.bixolonPrint.CodePage.CP_1252_LATIN1 // define code page, default value is set to CP_1252_LATIN1. }; }); }); printerApp.controller("ExampleController",function($scope){ $scope.print = function(){ cordova.plugins.bixolonPrint.addLine("hello cordova!"); cordova.plugins.bixolonPrint.printText(); } })

On Tue, Feb 14, 2017 at 10:58 AM, pietervw notifications@github.com wrote:

I eventually got it working with this plugin. https://github.com/alfonsovinti/cordova-plugin-bixolon-print

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/srehanuddin/Cordova-Plugin-Bluetooth-Printer/issues/1#issuecomment-279612071, or mute the thread https://github.com/notifications/unsubscribe-auth/AFZPYSBAWPEhXyhgdTd_xYVm4XQ2UJgSks5rcTuSgaJpZM4HwZrx .

-- Thanks & Regards

*Venkat Raman.K [ *Web & Android Developer ] +91 9790595438 +91 7806843158

otavioboari commented 7 years ago

Have you found a way to print images?

CesarBalzer commented 7 years ago

That person, I made a pull request of a change in the function of printing of images that solved my problem, I hope it helps you too.

wonk4rol commented 6 years ago

@CesarBalzer did it tested n worked ?

CesarBalzer commented 6 years ago

I tested yes @wonk4rol , with varying base64 images

SudarVenkat commented 6 years ago

Thanks for help

On May 21, 2017 8:19 PM, "Cesar Edenir Balzer" notifications@github.com wrote:

I tested yes @wonk4rol https://github.com/wonk4rol , with varying base64 images

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/srehanuddin/Cordova-Plugin-Bluetooth-Printer/issues/1#issuecomment-302941363, or mute the thread https://github.com/notifications/unsubscribe-auth/AFZPYbBMO88vJxX2xHGuTHGWHtJYedNBks5r8E7sgaJpZM4HwZrx .

CesarBalzer commented 6 years ago

@ivangutierrezr @srehanuddin @SudarVenkat @wonk4rol @otavioboari @pietervw @CurvesTech @shineirvin @ahsan-ab @jakeb-cloud @IMR707 Whoever tested the new function for printing the base64 image, leave feedback here to let me know if everything went well. It was hard work, but rewarding worked well for everyone!

shineirvin commented 6 years ago

OMG BRO @CesarBalzer You are awesome!!!!!!! Thank you so much man!

shineirvin commented 6 years ago

@CesarBalzer can you show us the image dude ? and how to resize the image size and align the position ?

CesarBalzer commented 6 years ago

Hello @shineirvin , you can use the commented string that is in the code of the @srehanuddin in line 261, I printed with it that generates this first image, and with the logo of my application of the second image, the measurement used was maximum and of 200px X 200px. The last image and the final result in the printer. I also used the string that our friend @wonk4rol put in the post, I just can not remember which image is generated, but it worked, too.

indice logo-round

20170522_084010

wonk4rol commented 6 years ago

Hai @CesarBalzer , can you explain the steps to solve the problem, i don't know what must i do to your pull request :-D

shineirvin commented 6 years ago

Hi @CesarBalzer, "you can use the commented string that is in the code of the @srehanuddin in line 261" I cant find this. help.

CesarBalzer commented 6 years ago

Hi @shineirvin here is the code in pastebin https://pastebin.com/TqLPzMeY @wonk4rol Now we need to wait for the @srehanuddin to accept the pull and publish.

kruakz commented 6 years ago

great plugin.. you can add method on your code like this `//print image

private byte[] recollectSlice(int y, int x, int[][] img) {
    byte[] slices = new byte[] {0, 0, 0};
    for (int yy = y, i = 0; yy < y + 24 && i < 3; yy += 8, i++) {
        byte slice = 0;
 for (int b = 0; b < 8; b++) {
            int yyy = yy + b;
     if (yyy >= img.length) {
         continue;
     }
     int col = img[yyy][x]; 
     boolean v = shouldPrintColor(col);
     slice |= (byte) ((v ? 1 : 0) << (7 - b));
 }
        slices[i] = slice;
    }

    return slices;
}

private boolean shouldPrintColor(int col) {
    final int threshold = 127;
    int a, r, g, b, luminance;
    a = (col >> 24) & 0xff;
    if (a != 0xff) {// Ignore transparencies
        return false;
    }
    r = (col >> 16) & 0xff;
    g = (col >> 8) & 0xff;
    b = col & 0xff;

    luminance = (int) (0.299 * r + 0.587 * g + 0.114 * b);

    return luminance < threshold;
}

//This will send data to bluetooth printer
boolean printImage(CallbackContext callbackContext, String msg) throws IOException {

    try {
        final String encodedString = msg;
        final String pureBase64Encoded = encodedString.substring(encodedString.indexOf(",")  + 1);

        final byte[] decodedBytes = Base64.decode(pureBase64Encoded, Base64.DEFAULT);

        Bitmap decodedBitmap = BitmapFactory.decodeByteArray(decodedBytes, 0, decodedBytes.length);

        bitmap = decodedBitmap;

        int mWidth = bitmap.getWidth();
        int mHeight = bitmap.getHeight();

        int[][] result = new int[mHeight][mWidth];
        for (int row = 0; row < mHeight; row++) {
            for (int col = 0; col < mWidth; col++) {
                result[row][col] = bitmap.getPixel(col, row);
            }
        }

     // Set the line spacing at 24 (we'll print 24 dots high)
        mmOutputStream.write(SET_LINE_SPACE_24);
        for (int y = 0; y < result.length; y += 24) {
         // Like I said before, when done sending data, 
         // the printer will resume to normal text printing
            mmOutputStream.write(SELECT_BIT_IMAGE_MODE);
         // Set nL and nH based on the width of the image
            mmOutputStream.write(new byte[]{(byte)(0x00ff & result[y].length)
                                    , (byte)((0xff00 & result[y].length) >> 8)});
         for (int x = 0; x < result[y].length; x++) {
          // for each stripe, recollect 3 bytes (3 bytes = 24 bits)
             mmOutputStream.write(recollectSlice(y, x, result));
         }

         // Do a line feed, if not the printing will resume on the same line
         mmOutputStream.write(LINE_FEED);
        }
        mmOutputStream.write(SET_LINE_SPACE_30);
        //bitmap=resizeImage(bitmap, imageWidth * 8, mHeight);
        //bitmap=resizeImage(bitmap, 48 * 8, mHeight);

        //byte[]  bt =getBitmapData(bitmap);

        //bitmap.recycle();

        //mmOutputStream.write(bt);

        // tell the user data were sent
        //Log.d(LOG_TAG, "Data Sent");
        callbackContext.success("Data Sent");
        return true;

    } catch (Exception e) {
        String errMsg = e.getMessage();
        Log.e(LOG_TAG, errMsg);
        e.printStackTrace();
        callbackContext.error(errMsg);
    }
    return false;
}`
kavin12 commented 6 years ago

how to print a simple image as base64 in cordova android ,,,,,

CesarBalzer commented 6 years ago

@kavin12 the examples are all there, read the documentation and see the issues, have everything explained already

preetijolapra11 commented 6 years ago

hey i have changed code from @CesarBalzer pull request but it is not working.. Please help me.. barcode

preetijolapra11 commented 6 years ago

Edited Comment: `import { Component } from '@angular/core'; import { IonicPage, NavController } from 'ionic-angular';

declare let BTPrinter: any; @IonicPage() @Component({ selector: 'page-print', templateUrl: 'print.html', }) export class PrintPage {

constructor(public navCtrl: NavController) {
}

print() {
    return new Promise((resolve, reject) => {
        BTPrinter.list(function(list) {
            console.log("Printer List Success: " + list);
            resolve(list);
        }, function(err) {
            console.log("Printer List Error: " + err);
            reject(err)
        });
    }).then((list) => {
        return new Promise((resolve) => {
            resolve('BALAJI-F425344C');
        });
    }).then((printer) => {
        return new Promise((resolve, reject) => {
            BTPrinter.connect(function(data) {
                console.log("Connection Success: " + data);
                resolve(data);
            }, function(err) {
                console.log("Connection Error: " + err)
                reject(err);
            }, printer);
        });
    }).then((status) => {

        return new Promise((resolve, reject) => {
            BTPrinter.print(function(data) {
                console.log("Print Image Success: " + data);
                resolve(data);
            }, function(err) {
                console.log("Print Image Error: " + err);
                reject(err)
            }, encodedString);
        }).then((rs) => {
            BTPrinter.disconnect(function(data) {
                console.log("Disconnected Success");
                console.log(data)
            }, function(err) {
                console.log("Error");
                console.log(err)
            })
        });
    });
}

} `

Thanks for reply @CesarBalzer and I have removed base64 string which i have copied from https://pastebin.com/TqLPzMeY And completely removed plugin and added from your git repo https://github.com/CesarBalzer/Cordova-Plugin-Bluetooth-Printer.git And its working good when i am printing a string.. this problems occurs while printing an image.. This is printer http://www.handheldmachine.com/2-inch-bluetooth-thermal-printer-3602345.html which we are using

CesarBalzer commented 6 years ago

Hello @preejol , first of all edit your post please and remove the base64 string, and put in the paste bin, Now tell me, are the other functions working? What may be happening differently and in relation to the printer model. If you put the base64 string directly in the java class and run it appears the same thing? Just remember that any changes in the java class should be done with the uninstalled plugin of your project

moonflowerkhan commented 6 years ago

i wan to print the text of string like billing format please help me. img_20170803_212027

lansas commented 6 years ago

@CesarBalzer there is no way to set image size larger than 200x200 ?

moonflowerkhan commented 6 years ago

@CesarBalzer there is no way to set image size larger than 200x200 ? Then how to print image which has more length in height

CesarBalzer commented 6 years ago

@moonflowerkhan @lansas I have not tried this yet, but as soon as I have time I'll take a look at it to help you

avandermeer commented 6 years ago

@moonflowerkhan @CesarBalzer I had the same issue; I solved the problem by editing the code in the decodeBitmap function at line 430 - 446.

Just replace

String widthHexString = Integer.toHexString(bmpWidth % 8 == 0 ? bmpWidth / 8 : (bmpWidth / 8 + 1));
if (widthHexString.length() > 2) {
    Log.d(LOG_TAG, "DECODEBITMAP ERROR : width is too large");
    return null;
} else if (widthHexString.length() == 1) {
    widthHexString = "0" + widthHexString;
}
widthHexString = widthHexString + "00";

String heightHexString = Integer.toHexString(bmpHeight);
if (heightHexString.length() > 2) {
    Log.d(LOG_TAG, "DECODEBITMAP ERROR : height is too large");
    return null;
} else if (heightHexString.length() == 1) {
    heightHexString = "0" + heightHexString;
}
heightHexString = heightHexString + "00";

by

        //construct xL and xH
        int xL = bmpWidth % 256;
        int xH = (bmpWidth - xL) / 256;

        String xLHex = Integer.toHexString(xL);
        String xHHex = Integer.toHexString(xH);
        if(xLHex.length() == 1){
            xLHex = xLHex + "0";
        }
        if(xHHex.length() == 1){
            xHHex = xHHex + "0";
        }
        String widthHexString = xLHex + xHHex;

        //construct yL and yH
        int yL = bmpHeight % 256;
        int yH = (bmpHeight - yL) / 256;

        String yLHex = Integer.toHexString(yL);
        String yHHex = Integer.toHexString(yH);
        if(yLHex.length() == 1){
            yLHex = yLHex + "0";
        }
        if(yHHex.length() == 1){
            yHHex = yHHex + "0";
        }
        String heightHexString = yLHex + yHHex;

Background info: The ESC/POS api requires two bytes for describing the height: yL and yH; yL is the modulo of the height by 256. yH is the height minus the modulo divided by 256.

An example:

height = 634; yL = 634 % 256 = 122; yH = (634-122)/256 = 2;

In the old code, the height was placed in only yL; yH was left zero. In that case, the max height is determined by the largest two-digit hex value (FF = 255), which is a large difference considering the max height when usin yH (about 256 + 256^2 theoretically).

By the way, the same goes for the width (xL and xH).

CesarBalzer commented 6 years ago

Wonder, now the plugin is complete, this problem at the time I did not realize, and the example formula you showed is exactly the right one, I believe it helps everyone who was with this height / width problem. Thank you for your help @avandermeer

moonflowerkhan commented 6 years ago

The height problem solved @avandermeer and @CesarBalzer but the printing is gng from left to right like this can u please tell me what to do imf1

avandermeer commented 6 years ago

I am not sure, but this could actualy be the correct behavior. If the width of the image is to large for the printer, it seems to cut the image and place the remaining part underneath.

I guess the best solution is to make sure your image does not exceed the max width of the printer, which is about 384px for most printers.

moonflowerkhan commented 6 years ago

yeah the image width is 380px in html 2 canvas which is the perfect width for thermal printer and the problem is first it is printing properly next it is moving the image position i wonder why @avandermeer and @CesarBalzer

avandermeer commented 6 years ago

I guess this issue only occurs when the modulo of bmpWidth is not 0. I can not test this on a printer, but can you try to replace

        //construct xL and xH
        int xL = bmpWidth % 256;
        int xH = (bmpWidth - xL) / 256;

by

        //construct xL and xH
        bmpWidth = bmpWidth + (bmpWidth % 8);  
        int xL = bmpWidth % 256;
        int xH = (bmpWidth - xL) / 256;

(I added one row).

Please let me know if this works. Otherwise, we have to switch back to the old code for the width.

update

I found that xL and xH are calculated using the amount of horizontal bytes instead of dots. Since there are 8 dots in one byte, the bmpWidth must be divided by 8. The result:

        //construct xL and xH
        //there are 8 pixels per byte. In case of modulo: add 1 to compensate.
        bmpWidth = bmpWidth % 8 == 0 ? bmpWidth / 8 : (bmpWidth / 8 + 1);  
        int xL = bmpWidth % 256;
        int xH = (bmpWidth - xL) / 256;
lansas commented 6 years ago

Have you any idea why printer prints base64 characters sometimes? It prints image correctly too. Maybe Java codes need time read and send data?

moonflowerkhan commented 6 years ago

img_20170831_205146 @avandermeer and @CesarBalzer same result it is changing the image position tht is the main problem first time it is printing correct but next when we print again it is moving right

if u are free please contact me at any time or can we do teamweaver +91 8971681088- country-india state=karnataka city=bangalore

christianversloot commented 6 years ago

@lansas I figured out together with @avandermeer that it stops printing Base64 characters when you can divide the image width by 8, and probably only when it's 48 * 8 = 384 pixels wide.

This probably occurs because in our code the resizeImage method in the Java class is called with 48 * 8 as a parameter.

@moonflowerkhan also experiencing this, trying to figure out what is happening. Flushing the output stream does not help, maybe it gets fixed if we can reposition the printer after every print.

moonflowerkhan commented 6 years ago

christianversloot but how to fix I cannot debug Java in visual studio