Simple Android library (webview based) for viewing pdf files using Mozilla's PDF.js library for wieving local pdf files.
Step 1. Add the JitPack repository to your build file
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
compile 'com.github.truefedex:APDFJS:v1.0.4'
}
Now add widget to your layout:
<com.github.truefedex.apdfjs.PDFJSView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/apdfjs"/>
And use simple api:
PDFJSView apdfjs = (PDFJSView)findViewById(R.id.apdfjs);
apdfjs.loadFromAssets("compressed.tracemonkey-pldi-09.pdf");
- PDF.js for displaying pdf in webview