可能重复: 如何将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 ,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.
项目:PdfRenderer
有一个名为Java类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 :)