简体   繁体   English

如何从wifi打印机打印图像?

[英]How to print image from wifi printer?

I am working on an app in which there is an option to print the badges. 我正在开发一个应用程序,其中有一个选项可以打印徽章。 Currently I am using BrotherPrinterSDK but it will restrict the functionality for Brother Printers only. 目前我使用的是BrotherPrinterSDK,但它仅限制Brother打印机的功能。

Can anyone help me with a demo to find a list of nearby wifi printers and print by selecting any one of them? 任何人都可以帮我一个演示,找到附近的无线打印机列表,并选择其中任何一个打印?

Moreover Brother Printer SDK is not working properly in the versions above marshmallow. 此外,Brother Printer SDK在marshmallow上面的版本中无法正常工作。 So I want to switch to some other method 所以我想切换到其他方法

Mopria Alliance is an open system for printing to wi-fi and networked printers. Mopria Alliance是一个用于打印到Wi-Fi和网络打印机的开放系统。 How to Print with Mopria Their driver (which is an app) is Here 如何用Mopria打印他们的驱动程序(这是一个应用程序)就在这里

In your app, on startup, you can check if Mopria is installed, and send them to the Mopria App, if not. 在您的应用程序中,在启动时,您可以检查是否已安装Mopria,如果没有,则将其发送到Mopria应用程序。

In your app, add a "Print" menu option or button, and have it open the Mopria Printers tab, which will search for local devices. 在您的应用程序中,添加“打印”菜单选项或按钮,然后打开Mopria打印机选项卡,该选项卡将搜索本地设备。 Your app will likely want permissions to turn on Wi-Fi if it is not on (this doesn't sound like a problem from your description). 如果未启用Wi-Fi,您的应用可能需要启用Wi-Fi权限(这听起来不像您的说明中的问题)。

I did some testing on this a couple years ago, so I will look for some demo code when I get home. 几年前我做了一些测试,所以当我回到家时,我会寻找一些演示代码。

Best option so far is using Google cloud printing 目前为止最好的选择是使用谷歌云打印

so no need relay on other third party apps, but user must add there printer with his own google id 所以不需要在其他第三方应用程序中继,但用户必须添加具有自己的谷歌ID的打印机

ref: https://www.google.com/cloudprint/learn/index.html 参考: https//www.google.com/cloudprint/learn/index.html

As mention here https://www.google.com/cloudprint/learn/printers/ they support wide range of printers, 正如这里提到的https://www.google.com/cloudprint/learn/printers/,它们支持各种打印机,

To make it programmatically check https://developers.google.com/cloud-print/docs/android 要以编程方式进行检查,请访问https://developers.google.com/cloud-print/docs/android

In my experience when using a Wi-Fi printer you should use the specific SDK provided by printer's manufactures. 根据我使用Wi-Fi打印机的经验,您应该使用打印机制造商提供的特定SDK。 It's easy and prints faster than any other app dependent SDK. 它比任何其他依赖于应用程序的SDK更容易打印。 In case SDK is not working may be because of some permissions that you need to ask on run time as Android 6 and above need user to accept some permissions like Contact, SMS etc. you can look here for that. 如果SDK无法正常工作,可能是因为您需要在运行时询问一些权限,因为Android 6及更高版本需要用户接受一些权限,如联系人,短信等, 您可以在这里查看。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM