【问题标题】:Android Google Cloud Print - Document missingAndroid Google 云打印 - 缺少文档
【发布时间】:2013-02-09 13:38:18
【问题描述】:

我想从我的 android 应用程序打印到我在 Google 云打印中注册的打印机。但是每次我尝试打印网页时,总是会出现文档丢失错误。这是我的代码,但我不知道是哪一行导致了错误。

public void print() {
    Uri docUri = Uri.parse("http://myserver.com/view/myusername");
    String docMimeType = "text/html";
    String docTitle = "myTestPage";
    Intent printIntent = new Intent(myContext, PrintDialogActivity.class);
    printIntent.setDataAndType(docUri, docMimeType);
    printIntent.putExtra("title", docTitle);
    startActivity(printIntent);
}

所以基本上,http://myserver.com/demo/view/myusername 是我要打印的网页,而 text/html 是我提供的 mime 类型。有人可以告诉我是哪一部分导致了错误,因为我尝试了笔记本电脑浏览器中的 URL 并加载了网页。非常感谢。 :D

【问题讨论】:

    标签: android mime google-cloud-print


    【解决方案1】:

    嗯,我不确定我的代码有什么问题,而且我仍然不知道 mime 类型应该是什么。所以我想出了一个解决方案:

    1. 以编程方式生成 html 文件
    2. 用“text/html”类型打印

    这应该可以完成。 :)

    【讨论】:

    • 是的,我自己用过这个解决方案
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-06-17
    • 2013-04-24
    • 2012-04-07
    • 2015-08-14
    • 2012-04-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多