在android中打印现有的pdf文件 [英] Print existing pdf file in android

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

问题描述

大家好,所以我试图在android上构建一个小样本打印应用程序,但似乎无法打印现有的pdf.关于使用画布创建自定义文档的文档很多,但是我已经有了该文档.基本上,我只是希望能够读取pdf文档并将其作为文件输出流直接发送到要打印的打印机.感谢您的帮助.

Hey everyone so I am trying to build a small sample printing app on android and can't seem to print an existing pdf. There is plenty of documentation on creating a custom document with the canvas but I already have the document. Basically I just want to be a able to read in a pdf document and send it as a file output stream directly to the printer to be printed. Any help is appreciated.

推荐答案

基本上,我只是希望能够读取pdf文档并将其作为文件输出流直接发送到要打印的打印机.

Basically I just want to be a able to read in a pdf document and send it as a file output stream directly to the printer to be printed.

这是严格不可能的,除非您找到某些提供此类API的Android专用打印机.

That's not strictly possible, unless you find some particular printer that offers such an API for Android.

如果您想使用Android打印框架,则需要创建一个可以处理现有PDF文件的PrintDocumentAdapter. 此示例项目演示了

If you wish to use the Android printing framework, you will need to create a PrintDocumentAdapter that can handle your existing PDF file. This sample project demonstrates one such PrintDocumentAdapter, though it is not general-purpose.

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

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