How to Create pdf viewer app using Android Studio

First of All thanks for visiting my website, and we are here to share with you one of the most best app which help you to earn money through android studio.
Lets Start :

Step 1 :
First of all create a new project in your Android Studio, and choose Empty Activity

Step 2 :
OK after creating our project in Android Studio, you need to open build.gradle(Module:App) file and
add this library in the dependency section.

implementation 'com.github.barteksc:android-pdf-viewer:3.0.0-beta.5'

Step 3 :
So now open your main_activity.xml and add this line of code

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android=""



Step 4 :
Now open your first create the object of PDFView and after that add this code.

PDFView book;
int position = -1;
//PDF View
PDFView book = findViewById(; 
position = getIntent().putExtra("position", 
position).getIntExtra("position", -1); 
book.fromAsset("book.pdf") .enableSwipe(true) 
// allows to block changing pages using swipe
// .swipeHorizontal(true)
// render annotations (such as comments, colors or forms)
.scrollHandle(new DefaultScrollHandle(this))
 // improve rendering a little bit on low-res screens
// spacing between pages in dp. To define spacing color, set view background

Step 5 :
Create Asset folder and put pdf file .
follow my instructions please…
now run your app.

That’s it, friends, this is the correct and simple way to create pdf viewer application using android studio. Just follow the above steps and copy paste code carefully at the correct location mentioned above.

if you found this article helpful please do comment below and share the article to support me. if you have any suggestion please feel free to comment below.

Leave a Comment

Your email address will not be published. Required fields are marked *