I'd recommend considering MuPDF which has already been ported for use on Android several times without reliance on Java. MuPDF is optimized for lightweight on-screen PDF rendering, making it perfect for mobile use.

Please note that MuPDF and all the derived projects are not suitable for the commercial use and you should consider alternatives if you are not developing an open source GPL project.

Answer from userx on Stack Overflow
🌐
Medium
medium.com › @generalfocus1 › build-your-own-android-pdf-reader-from-scratch-using-android-studio-ac65601eb90
Build Android PDF Reader From Scratch Using Android Studio | by Oyinkansola Olabode | Medium
April 6, 2020 - I’ll be explaining how to make an inbuilt pdf reader in your android application and also how to load a pdf file from your internal or…
🌐
Nutrient
nutrient.io › blog › sdk › how to build an android pdf viewer
Build an Android PDF viewer using Nutrient: A step-by-step guide
1 month ago - To kick off, we’ll start by setting up a new project in Android Studio to build your Android PDF viewer using Nutrient. We’ll walk you through opening a PDF document from the android-assets folder and later, how to access files from your ...
Discussions

How to create our own PDF viewer for Android? - Stack Overflow
I want to build a PDF reader/viewer that could be used in my Android application, but I can't use Google docs to read my content. I can't use any PDF reader already installed in my device. It shou... More on stackoverflow.com
🌐 stackoverflow.com
how to read pdf file file in android studio - Stack Overflow
I'm a beginner in android development , I want to make android app that can read pdf files. the pdf files that i have is with large contests (each pdf file around 60 mb) , as i searched i need to s... More on stackoverflow.com
🌐 stackoverflow.com
android - Example of code to implement a PDF reader - Stack Overflow
I want to implement a PDF reader in the application that I am doing, I have found several APIs, but none of them were open source. Does any of you guys know a good free alternative? Slight adaptat... More on stackoverflow.com
🌐 stackoverflow.com
android - I want to open .pdf file in my application - Stack Overflow
I want to open a document file in Android application with help of Android studio. How can be possible? Should I need to use web view? I had try source code from many webs but file was opened by ot... More on stackoverflow.com
🌐 stackoverflow.com
February 23, 2018
People also ask

More about PdfActivity

PdfActivity is a public class that extends AppCompatActivity(opens in a new tab) and implements [PdfUi], [PdfActivityListener], and PdfActivityComponentsApi. It’s an activity with fully integrated views and behavior, and it can be invoked by the simple helper methods [showDocument][showdocument]) and [showImage][showimage]).

🌐
nutrient.io
nutrient.io › blog › sdk › how to build an android pdf viewer
Build an Android PDF viewer using Nutrient: A step-by-step guide
What is an intent in Android?

Intents are messages you pass to the Android OS. They describe actions you want the system to perform on your behalf. After describing an intent, you pass it to the OS and act on the result. Usually, the result is passed to a callback function.

🌐
nutrient.io
nutrient.io › blog › sdk › how to build an android pdf viewer
Build an Android PDF viewer using Nutrient: A step-by-step guide
What’s a request code used for in Android?

In Android, request codes help identify intents and their corresponding results. The best place to declare a request code is in a separate file that holds all your constants.

🌐
nutrient.io
nutrient.io › blog › sdk › how to build an android pdf viewer
Build an Android PDF viewer using Nutrient: A step-by-step guide
🌐
GeeksforGeeks
geeksforgeeks.org › android › how-to-create-dynamic-pdf-viewer-in-android-with-firebase
How to Create Dynamic PDF Viewer in Android with Firebase? - GeeksforGeeks
Step 3: Add the dependency for PDF Viewer in build.gradle file · Navigate to the app > Gradle Scripts > build.gradle file and add below dependency in it. implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
Published   July 23, 2025
🌐
ComPDF
compdf.com › blog › build-an-android-pdf-viewer-or-editor-in-java
How to Build a Java Android PDF Viewer or Editor
ComPDF also provides the guides to build an Android PDF Editor. 1. Copy a PDF document into the assets directory of your Android project. For example, import the file Quick Start Guide.pdf to the path src/main/assets.
Top answer
1 of 1
2

You can view a pdf file in an android project in different ways. I will describe some of them here-

1. Using Library: Steps are below:

Installation Add to build.gradle: implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
ProGuard If you are using ProGuard, add following rule to proguard config file:
-keep class com.shockwave.**
Include PDFView in your layout
<com.github.barteksc.pdfviewer.PDFView android:id="@+id/pdfView" android:layout_width="match_parent" android:layout_height="match_parent"/>
Further link is here
2. Load pdf url into webview:

webview = (WebView)findViewById(R.id.webview);
    progressbar = (ProgressBar) findViewById(R.id.progressbar);
    webview.getSettings().setJavaScriptEnabled(true);
    String filename = file_url_with_name;
    webview.loadUrl(file_url + filename);

    webview.setWebViewClient(new WebViewClient() {

        public void onPageFinished(WebView view, String url) {
            // do your stuff here
            progressbar.setVisibility(View.GONE);
        }
    });


3. Manually show PDF file into Imageview

// Example for creating manual PDF viewer into imageview used butterknife view binding<br/>

public class PdfRenderActivity extends AppCompatActivity {

    @BindView(R.id.pdf_image) ImageView imageViewPdf;
    @BindView(R.id.button_pre_doc) FloatingActionButton prePageButton;
    @BindView(R.id.button_next_doc) FloatingActionButton nextPageButton;

    private static final String FILENAME = "report.pdf";

    private int pageIndex;
    private PdfRenderer pdfRenderer;
    private PdfRenderer.Page currentPage;
    private ParcelFileDescriptor parcelFileDescriptor;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_pdf_render);
        ButterKnife.bind(this);
        pageIndex = 0;
    }

    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    @Override
    protected void onStart() {
        super.onStart();
        try {
            openRenderer(getApplicationContext());
            showPage(pageIndex);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    @Override
    public void onStop() {
        try {
            closeRenderer();
        } catch (IOException e) {
            e.printStackTrace();
        }
        super.onStop();
    }

    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    @OnClick(R.id.button_pre_doc)
    public void onPreviousDocClick(){
        showPage(currentPage.getIndex() - 1);
    }

    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    @OnClick(R.id.button_next_doc)
    public void onNextDocClick(){
        showPage(currentPage.getIndex() + 1);
    }

    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    private void openRenderer(Context context) throws IOException {
        // In this sample, we read a PDF from the assets directory.
        File file = new File(context.getCacheDir(), FILENAME);
        if (!file.exists()) {
            // Since PdfRenderer cannot handle the compressed asset file directly, we copy it into
            // the cache directory.
            InputStream asset = context.getAssets().open(FILENAME);
            FileOutputStream output = new FileOutputStream(file);
            final byte[] buffer = new byte[1024];
            int size;
            while ((size = asset.read(buffer)) != -1) {
                output.write(buffer, 0, size);
            }
            asset.close();
            output.close();
        }
        parcelFileDescriptor = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY);
        // This is the PdfRenderer we use to render the PDF.
        if (parcelFileDescriptor != null) {
            pdfRenderer = new PdfRenderer(parcelFileDescriptor);
        }
    }

    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    private void closeRenderer() throws IOException {
        if (null != currentPage) {
            currentPage.close();
        }
        pdfRenderer.close();
        parcelFileDescriptor.close();
    }

    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    private void showPage(int index) {
        if (pdfRenderer.getPageCount() <= index) {
            return;
        }
        // Make sure to close the current page before opening another one.
        if (null != currentPage) {
            currentPage.close();
        }
        // Use `openPage` to open a specific page in PDF.
        currentPage = pdfRenderer.openPage(index);
        // Important: the destination bitmap must be ARGB (not RGB).
        Bitmap bitmap = Bitmap.createBitmap(currentPage.getWidth(), currentPage.getHeight(),
                Bitmap.Config.ARGB_8888);
        // Here, we render the page onto the Bitmap.
        // To render a portion of the page, use the second and third parameter. Pass nulls to get
        // the default result.
        // Pass either RENDER_MODE_FOR_DISPLAY or RENDER_MODE_FOR_PRINT for the last parameter.
        currentPage.render(bitmap, null, null, PdfRenderer.Page.RENDER_MODE_FOR_DISPLAY);
        // We are ready to show the Bitmap to user.
        imageViewPdf.setImageBitmap(bitmap);
        updateUi();
    }

    /**
     * Updates the state of 2 control buttons in response to the current page index.
     */
    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    private void updateUi() {
        int index = currentPage.getIndex();
        int pageCount = pdfRenderer.getPageCount();
        prePageButton.setEnabled(0 != index);
        nextPageButton.setEnabled(index + 1 < pageCount);
    }

    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    public int getPageCount() {
        return pdfRenderer.getPageCount();
    }

}

Doc is here

Find elsewhere
🌐
Android Developers
developer.android.com › camera & media dev center › implement a pdf viewer
Implement a PDF viewer | Android media | Android Developers
November 17, 2025 - To incorporate the PDF viewer into your application, declare the androidx.pdf dependency in your app's module build.gradle file.
🌐
Quora
quora.com › How-can-I-develop-a-PDF-viewer-app-using-Android-Studio
How to develop a PDF viewer app using Android Studio - Quora
Quora is a place to gain and share knowledge. It's a platform to ask questions and connect with people who contribute unique insights and quality answers.
🌐
Apryse
apryse.com › blog › build-an-android-pdf-viewer-using-java
How to Build an Android PDF Viewer Using Java | Apryse
November 21, 2018 - By doing so, developers won't have to build their own PDF viewer from scratch. However, this isn't always the best solution. What if you want to view PDF documents directly in your app? Luckily, the Android SDK provides classes to handle PDF documents in apps running Android 5.0 or higher. In this blog post, we’ll use PdfRenderer from the android.graphics.pdf package to create a basic PDF viewer in your Android app.
🌐
Reintech
reintech.io › blog › implementing-pdf-reader-app-android-using-pdfrenderer
Implementing a PDF reader app for Android using PDFRenderer | Reintech media
February 3, 2026 - For applications requiring fine-grained control over rendering or custom UI interactions, the native PdfRenderer may be more appropriate. Create a new Android project in Android Studio with the "Empty Activity" template.
🌐
YouTube
youtube.com › watch
Add PDF Files in Android Apps | PDF Viewer | Android Studio - YouTube
This is a tutorial about how to add or show pdf files in android apps. PDF View Library: https://github.com/barteksc/AndroidPdfViewerJoin our Facebook Group ...
Published   January 24, 2021
🌐
YouTube
youtube.com › watch
How to Build An Android PDF Viewer - YouTube
In this video tutorial you'll learn how to build a PDF viewer for your Android application using the PSPDFKit’s library.The companion blog post:https://pspdf...
Published   October 4, 2022
Top answer
1 of 3
26

Use below code for that.

First.java

public class First extends ListActivity {

    String[] pdflist;
    File[] imagelist;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //setContentView(R.layout.main);

        File images = Environment.getExternalStorageDirectory();
        imagelist = images.listFiles(new FilenameFilter() {
            public boolean accept(File dir, String name) {
                return ((name.endsWith(".pdf")));
            }
        });
        pdflist = new String[imagelist.length];
        for (int i = 0; i < imagelist.length; i++) {
            pdflist[i] = imagelist[i].getName();
        }
        this.setListAdapter(new ArrayAdapter<String>(this,
                android.R.layout.simple_list_item_1, pdflist));
    }

    protected void onListItemClick(ListView l, View v, int position, long id) {
        super.onListItemClick(l, v, position, id);
        String path = imagelist[(int) id].getAbsolutePath();
        openPdfIntent(path);
    }

    private void openPdfIntent(String path) {
        try {
            final Intent intent = new Intent(First.this, Second.class);
            intent.putExtra(PdfViewerActivity.EXTRA_PDFFILENAME, path);
            startActivity(intent);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Second.java

public class Second extends PdfViewerActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
    }

    public int getPreviousPageImageResource() {
        return R.drawable.left_arrow;
    }

    public int getNextPageImageResource() {
        return R.drawable.right_arrow;
    }

    public int getZoomInImageResource() {
        return R.drawable.zoom_in;
    }

    public int getZoomOutImageResource() {
        return R.drawable.zoom_out;
    }

    public int getPdfPasswordLayoutResource() {
        return R.layout.pdf_file_password;
    }

    public int getPdfPageNumberResource() {
        return R.layout.dialog_pagenumber;
    }

    public int getPdfPasswordEditField() {
        return R.id.etPassword;
    }

    public int getPdfPasswordOkButton() {
        return R.id.btOK;
    }

    public int getPdfPasswordExitButton() {
        return R.id.btExit;
    }

    public int getPdfPageNumberEditField() {
        return R.id.pagenum_edit;
    }
}

And declared both activities into your manifest file.

2 of 3
3

There is a very good post about this on SO. In particular check out the answer given by Commons.Ware, it answers your question.

Following your comments I have added the links here from the SO post I mentioned above (source for projects you could not find):

  • Android-Pdf-Viewer-Library (hosted at Github)
  • APV (hosted at Google code, uses Mercurial)
  • Android PDF Viewer (hosted at Sourceforge, uses SVN)

So "checkout" or clone the repositories to your local file system to browse the code. As I mentioned in my comment check the licence of each library before you go any further to see if what you can and cannot do with the code.

🌐
YouTube
youtube.com › btech days
Make a PDF Reader App | Complete App | Android Project | Android Studio - YouTube
#donate#btechdays#purchaseDONATE US:-PayPal :- https://www.paypal.me/btechdaysUpi ID :- btechdays.care@oksbi-------------------------------------------------
Published   June 5, 2021
Views   24K
Top answer
1 of 1
2

You can open pdf files using Intents.

File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath()+"/example.pdf");
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file), "application/pdf");
intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
startActivity(intent);

If you dont like this method, and want to open pdf files inside your application, you can use a custom PDF Viewer.

In your gradle file compile this: 'com.github.barteksc:android-pdf-viewer:2.0.3'

After you sync your project, go to your xml file and add the PDF Viewer.

<com.github.barteksc.pdfviewer.PDFView android:id="@+id/pdfView"
     android:layout_width="match_parent"
     android:layout_height="match_parent"/>

Now in your .java file you will import:

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import com.github.barteksc.pdfviewer.PDFView;
import com.github.barteksc.pdfviewer.listener.OnLoadCompleteListener;
import com.github.barteksc.pdfviewer.listener.OnPageChangeListener;
import com.github.barteksc.pdfviewer.scroll.DefaultScrollHandle;
import com.shockwave.pdfium.PdfDocument;
 
import java.util.List;

You will Implement two methods: OnPageChangeListener and OnLoadCompleteListener

MAIN CODE:

    public static final String SAMPLE_FILE = "android_tutorial.pdf"; //your file path
    PDFView pdfView;
    Integer pageNumber = 0;
    String pdfFileName;
 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
 
 
        pdfView= (PDFView)findViewById(R.id.pdfView);
        displayFromAsset(SAMPLE_FILE);
    }
 
    private void displayFromAsset(String assetFileName) {
        pdfFileName = assetFileName;
 
        pdfView.fromAsset(SAMPLE_FILE)
                .defaultPage(pageNumber)
                .enableSwipe(true) 
                .swipeHorizontal(false)
                .onPageChange(this)
                .enableAnnotationRendering(true)
                .onLoad(this)
                .scrollHandle(new DefaultScrollHandle(this))
                .load();
    }
 
 
    @Override
     public void onPageChanged(int page, int pageCount) {
        pageNumber = page;
    }
 
 
    @Override
    public void loadComplete(int nbPages) {
        PdfDocument.Meta meta = pdfView.getDocumentMeta();
        printBookmarksTree(pdfView.getTableOfContents(), "-");
 
    }
 
    public void printBookmarksTree(List<PdfDocument.Bookmark> tree, String sep) {
        for (PdfDocument.Bookmark b : tree) {
            if (b.hasChildren()) {
                printBookmarksTree(b.getChildren(), sep + "-");
            }
        }
    }

Thats it!

P.S: First search on google, if you dont find something, write your question!

🌐
Blogger
devofandroid.blogspot.com › 2018 › 04 › pdf-reader-app-android-studio-tutorial.html
PDF reader app - Android Studio Tutorial
July 4, 2023 - A blog web site to learn the Android Application development from scratch to professional in Java and Kotlin using Android Studio. ... This tutorial is about: ✓Create PDF app. ✓Display Specific or all pages from PDF ✓Display PDF from Assets folder. ✓Add padding between pages ✓Passwords ✓Scroll PDF pages vertically or Swipe horizontally. implementation 'com.github.barteksc:android-pdf-viewer:3.0.0-beta.5'
🌐
Appsbuilders
appsbuilders.org › guides › how-to-create-pdf-viewer-android-studio
Appsbuilders
August 1, 2019 - Samsung doesn’t need to revolutionize the smartphone industry in 2018 it needs to iterate on all the hard work it
🌐
Mindorks
blog.mindorks.com › how-to-open-a-pdf-file-in-android-programmatically
How to open a PDF file in Android programmatically? - MindOrks
June 17, 2019 - In our tutorial, we will learn how to open a PDF file from Assets, Phone Storage, and from the Internet by using the AndroidPdfViewer library. Also, we will be using PRDownloader library by MindOrks to download files from the Internet and open it by AndoridPdfViewer . ... Open the app level build.gradle and add the below dependencies of AndroidPdfViewer and PRDownloader: implementation 'com.github.barteksc:android-pdf-viewer:2.8.2' implementation 'com.mindorks.android:prdownloader:0.6.0'
Top answer
1 of 4
31

I think you should use custom library for getting that done .See this and this

But there is a way for displaying PDF with out calling another application

This is a way for showing PDF in android app that is embedding the PDF document to android webview using support from http://docs.google.com/viewer

pseudo

String doc="<iframe src='http://docs.google.com/viewer?url=+location to your PDF File+' 
              width='100%' height='100%' 
              style='border: none;'></iframe>";

a sample is is shown below

 String doc="<iframe src='http://docs.google.com/viewer?url=http://www.iasted.org/conferences/formatting/presentations-tips.ppt&embedded=true' 
              width='100%' height='100%' 
              style='border: none;'></iframe>";

Code

    WebView  wv = (WebView)findViewById(R.id.webView); 
    wv.getSettings().setJavaScriptEnabled(true);
    wv.getSettings().setPluginsEnabled(true);
    wv.getSettings().setAllowFileAccess(true);
    wv.loadUrl(doc);
    //wv.loadData( doc, "text/html",  "UTF-8");

and in manifest provide

<uses-permission android:name="android.permission.INTERNET"/>

See this

Caution : I am not aware of compatibility issues with various android versions

In this approach the drawback is you need internet connectivity . But i think it satisfy your need

EDIT Try this as src for iframe

src="http://docs.google.com/gview?embedded=true&url=http://www.pc-hardware.hu/PDF/konfig.pdf"

try wv.loadData( doc , "text/html", "UTF-8"); . Both works for me

2 of 4
4

Download the source code from here (Display PDF file inside my android application)

Add this dependency in your Grade:

compile 'com.github.barteksc:android-pdf-viewer:2.0.3'

activity_main.xml

<RelativeLayout android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#ffffff"
    xmlns:android="http://schemas.android.com/apk/res/android" >

    <TextView
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:background="@color/colorPrimaryDark"
        android:text="View PDF"
        android:textColor="#ffffff"
        android:id="@+id/tv_header"
        android:textSize="18dp"
        android:gravity="center"></TextView>

    <com.github.barteksc.pdfviewer.PDFView
        android:id="@+id/pdfView"
        android:layout_below="@+id/tv_header"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>


    </RelativeLayout>

MainActivity.java

package pdfviewer.pdfviewer;

import android.app.Activity;
import android.database.Cursor;
import android.net.Uri;
import android.provider.OpenableColumns;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import com.github.barteksc.pdfviewer.PDFView;
import com.github.barteksc.pdfviewer.listener.OnLoadCompleteListener;
import com.github.barteksc.pdfviewer.listener.OnPageChangeListener;
import com.github.barteksc.pdfviewer.scroll.DefaultScrollHandle;
import com.shockwave.pdfium.PdfDocument;

import java.util.List;

public class MainActivity extends Activity implements OnPageChangeListener,OnLoadCompleteListener{
    private static final String TAG = MainActivity.class.getSimpleName();
    public static final String SAMPLE_FILE = "android_tutorial.pdf";
    PDFView pdfView;
    Integer pageNumber = 0;
    String pdfFileName;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        pdfView= (PDFView)findViewById(R.id.pdfView);
        displayFromAsset(SAMPLE_FILE);
    }

    private void displayFromAsset(String assetFileName) {
        pdfFileName = assetFileName;

        pdfView.fromAsset(SAMPLE_FILE)
                .defaultPage(pageNumber)
                .enableSwipe(true)

                .swipeHorizontal(false)
                .onPageChange(this)
                .enableAnnotationRendering(true)
                .onLoad(this)
                .scrollHandle(new DefaultScrollHandle(this))
                .load();
    }


    @Override
    public void onPageChanged(int page, int pageCount) {
        pageNumber = page;
        setTitle(String.format("%s %s / %s", pdfFileName, page + 1, pageCount));
    }


    @Override
    public void loadComplete(int nbPages) {
        PdfDocument.Meta meta = pdfView.getDocumentMeta();
        printBookmarksTree(pdfView.getTableOfContents(), "-");

    }

    public void printBookmarksTree(List<PdfDocument.Bookmark> tree, String sep) {
        for (PdfDocument.Bookmark b : tree) {

            Log.e(TAG, String.format("%s %s, p %d", sep, b.getTitle(), b.getPageIdx()));

            if (b.hasChildren()) {
                printBookmarksTree(b.getChildren(), sep + "-");
            }
        }
    }

}

Thanks!