【问题标题】:Printing from Android从 Android 打印
【发布时间】:2011-10-08 20:38:04
【问题描述】:

是否有任何简单而甜蜜的解决方案来打印简单的文本文件或图像 安卓?

我看过 Print 2 Share,但它不是免费的,也没有找到任何其他 API。

【问题讨论】:

    标签: android


    【解决方案1】:

    使用这个intentPrinterShare

    Android 开发人员,您可以轻松地将您的应用程序与 PrinterShare 集成,为您的用户提供打印功能。我们使用意图机制来触发手机上的打印作业。您可以在需要打印的地方将以下代码注入到您的应用程序中:

       Intent i = new Intent(Intent.ACTION_VIEW);
        i.setPackage("com.dynamixsoftware.printershare");
        i.setDataAndType(data_uri, data_type);
        startActivity(i);
    

    地点:

    data_uri - 要打印的对象的 Uri,例如“file:///sdcard/something.pdf”或“content://something”

    data_type - 哑剧类型。支持以下 MIME 类型:

    "application/pdf"
    "text/html"
    "text/plain"
    "image/png"
    "image/jpeg"
    "application/msword" - .doc
    "application/vnd.openxmlformats-officedocument.wordprocessingml.document" - .docx
    "application/vnd.ms-excel" - .xls
        "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" - .xlsx
        "application/vnd.ms-powerpoint" - .ppt
        "application/vnd.openxmlformats-officedocument.presentationml.presentation" - .pptx
    

    http://www.printershare.com/help-android-integration.sdf

    https://play.google.com/store/apps/details?id=com.dynamixsoftware.printershare&feature=more_from_developer#?"

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-20
      • 1970-01-01
      相关资源
      最近更新 更多