Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android PDF Viewer Library or muPDF library tutorials

I'm trying to read pdf files in my android application. I don't want to use the default pdf reader and simply open a new intent because I need my own GUI, and want to use the first page as a cover. Therefore I need to make my own pdf reader. I did some research and came across muPDF and Android PDF Viewer Library.

  1. I tried to follow tutorial to implement Android PDF Viewer Library, from the github description. But the problem is that it loads pdf file forever. Do I need to do something else than just the steps in the description?

  2. I can't find any tutorials for the muPDF library, are there any? How to implement it?

  3. If there is no useful answer for the previous two questions, are there any good pdf library out there with tutorials and good documentation?

Thank you, hopefully, I will be able to solve my problem

like image 652
dmacan23 Avatar asked Oct 20 '13 13:10

dmacan23


People also ask

What is PDF viewer in Android?

With Acrobat Reader, you can easily add sticky notes and text comments, mark up text, create bookmarks, and share PDF files. It also works with Adobe Acrobat online services where you can compress PDFs, convert them to other file formats (such as PDF to JPG), and much more.

Does Android have native PDF viewer?

First, there's a good chance you already have an app on your Android device that can open PDFs. Google Drive can do it, but so can e-book readers, like the Kindle app. To find out if you have an app that can open PDFs, just try to do so. Navigate to the file manager on your Android device and find a PDF file.

Does MuPDF support JavaScript?

Since the 1.2 release, MuPDF has optional support for interactive features such as form filling, JavaScript and transitions.


4 Answers

MuPDF is a very good library, you can definitely use it. If you need a complete example of Android app using MuPDF, I suggest you to take a look at this customizable magazine app on Github.

like image 110
Librelio Avatar answered Oct 14 '22 13:10

Librelio


first of all, if you want to use MUPDF inside an existing android app project you can follow the guide you find at this link (all credits go to the author, I didn't write this).

I am trying as well to integrate a very simple PDF reading/printing solution inside my app and i am struggling to strip down/simplify the MuPdf application demo you get by following that guide. I already managed (somehow) to remove annotation and file-picking features, but i would really need some help as well to get all the job done. There's really a lot of stuff and absolutely no documentation about this. I am simply trying to read the code and figure out what is needed and what is not, removing features one by one and being driven by the errors you get in catlog.

Also, as we both (if I understood correctly your needs) need just the PDF rendering features, would be great if someone points out how to (if possible) disable some of the unnecessary features built in the MuPDF library when building it from source (as DjVu support, just as an example).

Hope this helps, even if it is not a real answer to your question.

like image 27
valleymanbs Avatar answered Oct 14 '22 11:10

valleymanbs


This is how I succeeded in building a MuPDF lib on windows with Cygwin, android-ndk

  1. Download MuPDF 1.3 Source from https://code.google.com/p/mupdf/downloads/list unzip to folder c:/mupdf-1.3-source

  2. Install Cygwin: Download and run Run setup-x86.exe from http://cygwin.com/install.html when installing cygwin, make sure you selected make packages and C++ compilers

  3. Make generate. open cygwin terminal, run

    cd /cygdrive/
    cd c/mupdf-1.3-source
    make generate
    
  4. Install android-ndk: download android-ndk-r9d-windows-x86.zip and unzip it to

    c:/android-ndk-r9d
    
  5. Build mupdf lib: on windows cmd console:

    • preparation:

      cd c:/mupdf-1.3-source/platform/android
      copy local.properties.sample local.properties
      

      edit local.properties, uncomment

      #sdk.dir=C:\\Program Files (x86)\\Android\\android-sdk
      

      and change to

      sdk.dir=REAL andforid-sdk Folder
      
    • build: while still on c:/mupdf-1.3-source/platform/android, run:

      /android-ndk-r9d/ndk-build
      

      Upon the completion of the build, a folder named libs will be created under

      c:/mupdf-1.3-source/platform/android
      
  6. Create android apk. Open eclipse, create a new android project from existing code, browse to c:/mupdf-1.3-source/platform/android, now you can create a mupdf apk.

like image 6
billowavetor Avatar answered Oct 14 '22 13:10

billowavetor


Starting with Android 5.0 you can also use Android's internal PDF renderer and for manipulating PDF you can always use iTextg - just some alternatives for the future.

like image 3
pkzip Avatar answered Oct 14 '22 11:10

pkzip