Android PDF Rendering

烈酒焚心 提交于 2020-01-02 03:11:21

问题


I would like to render/open PDF file (stored in SDCard) in Android without using in-build application or viewer.

1) We have tried MuPDF open source library but rendering using this library is very slow.

2) Can we use iText library for rendering PDF files in Android (i.e. iText as a PDF Viewer).

Is there any other PDF library(open source) that can be used in Android Or suggest basic guideline for developing PDF viewer for Android.


回答1:


I've done some research in this field recently, I've tried more than 14 libraries on Android, I've done simple benchmarking on some high resolution print-ready PDF magazines and I'm currently considering to use MuPDF or Radaee in work as they went out as the best.

I've tried VuDroid and apv as well and they are very unstable, they are crashing very often on complex PDF documents and very slow in comparsion to MuPDF or Radaee.

Since MuPDF and Radaee (and some other libraries) are written in pure C and are used on Android through NDK, they are giving the best possible performance (and they both are paid for a commercial use).




回答2:


1) MuPDF is good to render textbook pdf in android while it may be slow to render pdf with big images. A lot of customizations and improvements especially memory usage control need to do if you want the MuPDF to run fast and stable on android platform. You can check out two open source projects VuDroid and apv which are based on MuPDF.

2) It's up to your requirements. The iText may be enough to render simple text pdf, but I don't think it has better performance than MuPDF or other libraries that developed by using C/C++.

Another choice is to use Poppler. A successful story is the popular android app ezPDF Reader is based on Poppler, although it's violating GPL license. The out of box Poppler needs more work than MuPDF to do to run on android smoothly. You can refer to the open source project apdfviewer.




回答3:


Take a look at my PDF reader for Android here at anddev. As I remember it uses modified PDFBox (without things related to editing), and features my own font converter (to feed fonts to Android and render them faster).

I don't develop PDF reader anymore and I can make all my changes opensource (though it will require some work, and time). You can try it out to find out how well it performs for you. Note: reader doesn't support encryption and copy-protection.



来源:https://stackoverflow.com/questions/7087454/android-pdf-rendering

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!