Coder Social home page Coder Social logo

btprinter's Introduction

The project is no longer maintenance

BtPrinter

BtPrinter is a simple bluetooth printer demo project. It helps those who is fresher to Android bluetooth printer

update log

2015-7-14 add print bitmap support

btprinter's People

Contributors

yefengjie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

btprinter's Issues

PrintPic 打印图片的类中 length 变量没有及时清零导致一些打印的问题。

@yefengfreedom 大神, 我使用了你的框架非常方便,谢谢!我碰到一个issue,就是PrintPic 中的length变量未能及时清零的问题。

    public float length = 0.0F;
   ... 省略若干代码
     /**
     * draw bitmap
     */
    public void drawImage(float x, float y, Bitmap btm) {
        try {
            // Bitmap btm = BitmapFactory.decodeFile(path);
            this.canvas.drawBitmap(btm, x, y, null);
            if (this.length < y + btm.getHeight())
                this.length = (y + btm.getHeight());
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (null != btm) {
                btm.recycle();
            }
        }
    }

其中:

if (this.length < y + btm.getHeight())
                this.length = (y + btm.getHeight());

第一次打印图片的高度是500,那么this.length = 500;
第二次打印图片的高度是300,if (this.length < y + btm.getHeight())这个判断无法进入。因为this.length = 500 但是 y + btm.getHeight()为300.
没有发现其他的地方有对this.length清零的方法。
还请大神检查。

字体大小

如何给指定行设置大小、行高这些样式。比如,第一行和第二行的字体大小、行高都不一样,如何来做

Printing Image Too Dark Problem

Hello Sir, When I try to print Pic using your code via POS 80mm Xprinter, the printed image comes out too dark version. I have tested it out using PNG image and image including text but all included images and text became too dark in the print-outs.
I just want the text remained normal (think and clear) in the print-outs.

Could you kindly please help me out sir.
Thanks.

in one button print

why if i put printTest(); and printBitmapTest(); in one button won't print?

demo app crashes on launch -org.greenrobot.eventbus.EventBusException: Subscriber class com.yefeng.night.btprinter.MainActivity_ and its super classes have no public methods with the @Subscribe annotation

classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' In project level Gradle

In app level gradle
def AAVersion = '4.6.0'
targetSdkVersion 29

annotationProcessor "org.androidannotations:androidannotations:$AAVersion"
implementation "org.androidannotations:androidannotations-api:$AAVersion"

Even If pro-guard rules set.

com.yefeng.night.btprinter E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.yefeng.night.btprinter, PID: 15563
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.yefeng.night.btprinter/com.yefeng.night.btprinter.MainActivity_}: org.greenrobot.eventbus.EventBusException: Subscriber class com.yefeng.night.btprinter.MainActivity_ and its super classes have no public methods with the @subscribe annotation
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2576)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2658)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1492)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5737)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:682)
Caused by: org.greenrobot.eventbus.EventBusException: Subscriber class com.yefeng.night.btprinter.MainActivity_ and its super classes have no public methods with the @subscribe annotation
at org.greenrobot.eventbus.SubscriberMethodFinder.findSubscriberMethods(SubscriberMethodFinder.java:67)
at org.greenrobot.eventbus.EventBus.register(EventBus.java:143)
at com.yefeng.night.btprinter.base.BaseActivity.onStart(BaseActivity.java:19)
at com.yefeng.night.btprinter.bt.BluetoothActivity.onStart(BluetoothActivity.java:50)
at com.yefeng.night.btprinter.MainActivity.onStart(MainActivity.java:46)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1245)
at android.app.Activity.performStart(Activity.java:6325)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2533)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2658) 
at android.app.ActivityThread.-wrap11(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1492) 
at android.os.Handler.dispatchMessage(Handler.java:111) 
at android.os.Looper.loop(Looper.java:207) 
at android.app.ActivityThread.main(ActivityThread.java:5737) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:682) 

How we can append text with Image

I want to print image ( QR Code ) and it's Text, alligned in the middle of paper and text after image in next line. I did try two things

  1. Adding text to the image call for printer
  2. Calling printing service immediately for text after calling printing service for image

both didn't worked. Can you help please ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.