打印使用Android的PhoneGap的插件的图像 [英] printing An image using phonegap plugin for android
问题描述
我要与我的应用程序中打印的图像。我需要为同一个PhoneGap的插件。这仅仅是一个针对浏览器的命令 window.print()
,但我不知道它的移动应用如何完成的。上有什么建议?
I need to print an image with my application. I need a phonegap plugin for the same. It is just a command window.print()
for browsers but I am not sure how its done for mobile applications. Any suggestions on that?
能否在我们的设备上配置的打印机?
Is it possible if we have the printer configured on the device?
推荐答案
什么是可能的,是落实发送
意图与打印应用程序分享。
What's possible is to implement the SEND
intent to share it with a printing application.
修改(打印应用你的应用程序会分享与列表):
EDIT (list of printing applications your app would "Share" with):
https://market.android.com/details?id=com。 dynamixsoftware.printershare
https://market.android.com/details?id= com.hp.android.print
https://market.android。 COM /详细信息?ID = jp.co.canon.bsd.android.aepp.activity
只是仅举几。这是真正期待的人,此刻打印唯一合理的途径。虽然与引进Android的 USB主机的支持,在未来,Linux的打印机驱动程序可能使他们进入Android和允许即插即用许多打印机打印播放只需在USB堵塞。
just to name a few. That's really the only reasonable way to expect people to print at the moment. Although with the introduction of Android's USB Host support, in the future, Linux Printer drivers may make their way into Android and allow for Plug and Play Printing from MANY printers just by plugging in a USB.
在您需要的非常最低限度:
At the very bare minimum you need:
<activity android:name=".ShareActivity">
<intent-filter
android:label="Share with my app">
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
在您的清单中......这至少会使其在共享上市露面。
in your manifest...which will at least make it show up in the 'share' listing.
您如何从正在显示页面发送的数据取决于你要导出/打印的东西。
How you send the data from the page you are displaying depends on what you want to export/print.
如果这是您要共享图像,就像你说的:
If it is an image you want to share, like you said:
的http://sudarmuthu.com/blog/sharing-content-in-android-using-action_send-intent
会有所帮助。基本上是一个图像,它看起来是这样的:
will help. Basically for an image, it would look something like:
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
Uri screenshotUri = Uri.parse(path);
sharingIntent.setType("image/png");
sharingIntent.putExtra(Intent.EXTRA_STREAM, screenshotUri);
startActivity(Intent.createChooser(sharingIntent, "Share image using"));
希望这是一个有效的解决方案,更不是浏览器的 window.print更复杂的()
: - (
现在,至于PhoneGap的
<一个href=\"http://stackoverflow.com/questions/4570701/phonegap-share-functionality-to-email-twitter-and-facebook\">Phonegap - 分享功能到电子邮件,Twitter和Facebook
和
http://smus.com/android-phonegap-plugins
应该有助于理解它的使用的共享。
should help in understanding it's use of sharing.
和
http://www.ryangillespie.com/downloads/SharePlugin.java
是一个实际的 PhoneGap的插件例如分享。
这篇关于打印使用Android的PhoneGap的插件的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!