如何将PDF页面转换为机器人的形象? [英] How to convert a PDF page to an image in Android?

查看:173
本文介绍了如何将PDF页面转换为机器人的形象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
  如何将PDF转换成图像?

所有我需要做的是采取(本地保存) PDF文档将一个或它的所有网页,图片格式一样JPG或PNG。

All I need to do is take a (locally saved) PDF-document and convert one or all of it's pages to image format like JPG or PNG.

我试过很多的的PDF渲染/查看如 APV PDF浏览器,的 APDFViewer ,的 droidreader Android的PDF ,<一个href="http://stackoverflow.com/questions/10070137/pdf-viewer-using-mupdf-library/10071012#10071012">MuPdf和许多其他人,但无法弄清楚迄今为止的如何将PDF页面转换成图像?

I've tried lot's of PDF Rendering/viewing solutions like APV PDF Viewer, APDFViewer, droidreader, android-pdf, MuPdf and many others but couldn't figure it out so far that how to convert a pdf-page into image?.

编辑:另外,我宁愿有一个PDF格式的图像转换器相比,我需要修改,​​以将PDF转换为图像的PDF渲染器

Also I'd rather have a PDF to image converter than a PDF renderer that I need to edit to convert PDF to image.

推荐答案

您必须看看这个开源项目为相同的需求,这可以帮助你做更多的事也。

You need to have look at this open-source for project for the same requirement, that can be helpful to you to do many more things also.

项目:<一href="http://grep$c$c.com/project/repo1.maven.org/maven2/org.swinglabs/pdf-renderer/">PdfRenderer

有一个名为Java类<一href="http://www.jarvana.com/jarvana/view/org/swinglabs/pdf-renderer/1.0.5/pdf-renderer-1.0.5-javadoc.jar!/index.html">PDFPage.java pdfview 包。这个类有一个方法来获取页面的图像。

There is one Java class named PDFPage.java in pdfview package. that class have a method to get Image of the page.

我也实施在我的测试项目同样的事情,在java code是 在这里为你 。我已创建了一个方法 SHOWPAGE ,它接受的页面没有和缩放级别并返回该页面位图

I have also implemented the same thing in my test project and the java code is here for you. I have created one method showPage which accepts the page no and zoom level and return that page as Bitmap.

希望这可以帮助你。你只需要获得项目或JAR的是,阅读详细记录JavaDoc以相同的,然后尝试,像我一样实现相同的。

Hope this can help you. You just need to get that Project or JAR for that, Read the well-documented JAVADOC for the same and then try and implement the same as I did.

把你的时间,编码快乐:)

Take your time, Happy Coding :)

这篇关于如何将PDF页面转换为机器人的形象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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