在Android的打印图像 [英] Print image in android

查看:148
本文介绍了在Android的打印图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是下面的code将命令发送到打印机。 temp文件夹中创建的文件发送到该文件夹​​。但它给了我一个错误说`

I am using the below code to send the command to the printer. The temp folder is created and the file is sent to the folder. but it gives me an error saying `

无活动来处理这个意图(ACT = com.dynamixsoftware.printershare.print DAT =文件:///mnt/sdcard/temp/picture1230841297.stream典型值=应用程序/ x-机器人 - 图片流(有临时演员)}

在code是

    public static boolean queuePictureStreamForPrinting( Context context, File f )
    {
        // send to print activity
        Uri uri = Uri.fromFile( f );
        Intent i = new Intent( PRINT_ACTION );
        i.setDataAndType( uri, "application/x-android-picture-stream" );
        i.putExtra( "scaleFitToPage", true );
        context.startActivity( i );

        return true;
    }

这是我缺少的是什么有什么建议?

Any suggestions on what am missing?

推荐答案

您缺少的应用程序,这实际上是能够使用的打印意图您尝试启动。 安装任何可接收 com.dynamixsoftware.printershare.print 意图。如果已经安装,请确保URI和MIME类型是有意义的该应用程序。

You are missing an app, that is actually able to use that print-intent you are trying to start. Install whatever can receive com.dynamixsoftware.printershare.print intents. If this is already installed, make sure the uri and mime-type make sense to that app.

这是意图仅仅是一个信号做一些工作。它会在运行时出动,所以没有编译时检查错误。这也允许在某些情况下,用户(例如,通过电子邮件发送)多个可能的接收者之间进行选择

An intent is only a signal to do some job. It will be dispatched at runtime, so there is no compile time checking for errors. This also allows the user in some cases (e.g. send by email) to choose between multiple possible receivers

这篇关于在Android的打印图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆