Coder Social home page Coder Social logo

rongpaydemo's People

Contributors

wll19890224 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

rongpaydemo's Issues

Help needed

Hello,
I came across your work in an sdk disk for a POS machine. Could spare a few seconds to help me?
I am trying to print while following your demo application

public void print(View view) {
        String msg = getPrintFormatMsg(mEditText1.getText().toString());
        try {
            Intent intent = new Intent();
            Bundle args = new Bundle();
            args.putString("msg", msg);   // 打印内容规范 请参考《全民付收银台线下插件商户销售单据打印规范》
            args.putString("packageName", getPackageName());  // 应用包名
            intent.putExtra("data", args);
            intent.setAction(ACTION_PRINT);  // 操作类型
            startActivity(intent);
        } catch (Exception e) {
            Log.e("TAG", e.getMessage());
        }
    }

But I keep getting this activity not found and It does't seem to be part of the demo project source.

private static final String ACTION_PRINT = "com.rongcapital.print";

Could you guide me on how to print a simple test file and or bitmap?

PS: Already tried this

byte[] buffer = msg.getBytes();
            PrintTask printTask = new PrintTask();
            Printer printer = new Printer();

            //Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_baseline_cloud_deposit);
            printTask.setPrintBuffer(buffer);
            //printTask.setPrintBitmap(bitmap);

            Log.d(TAG, new String(buffer));


            for (int i = 0; i < buffer.length; i++){
                Log.d(TAG, new String(String.valueOf(buffer[i])));
            }

            printer.startPrint(printTask, new PrinterCallback() {
                @Override
                public void onResult(int i, PrintTask printTask) {
                    Log.d(TAG, "Print Result: " + i);
                }
            });

But doesn't seem to print anything clear on the paper. Thanks again

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.