小雨_0128
小雨_0128
  • 发布:2020-04-08 11:27
  • 更新:2023-07-29 09:08
  • 阅读:4797

HTML5+Native.js,android调用PrintShare,连接无线打印机,实现预览打印pdf文件,

分类:Native.js
    var path = "/test.pdf";  
    var ComponentName = plus.android.importClass('android.content.ComponentName');  
    var Intent = plus.android.importClass('android.content.Intent');  
    var Uri = plus.android.importClass('android.net.Uri');  
    var Environment = plus.android.importClass('android.os.Environment');  
    var main = plus.android.runtimeMainActivity();  

    var skRoot = plus.android.invoke(Environment.getExternalStorageDirectory(), "getPath");  

    var comp = new ComponentName("com.dynamixsoftware.printershare", "com.dynamixsoftware.printershare.ActivityPrintDocuments");  
    var intent = new Intent();  
    intent.setComponent(comp);  
    intent.setAction("android.intent.action.VIEW");  
    intent.setType(type);  
    intent.setData(Uri.parse(skRoot + path));  

    main.startActivity(intent);
2 关注 分享
8***@qq.com 1***@qq.com

要回复文章请先登录注册

2***@qq.com

2***@qq.com

intent.setType(type); 这个type是什么
2020-05-11 19:37