0% found this document useful (0 votes)
107 views3 pages

Add The Below Comments in Build - Gradle (Module App)

The document provides instructions for displaying a PDF in an Android app using the android-pdf-viewer library. It includes adding the library dependency to build.gradle, changing the main activity layout to vertical linear layout and adding a PDFView widget, creating an asset folder, and programmatically loading a PDF from assets into the PDFView.

Uploaded by

Nelson Raja
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
107 views3 pages

Add The Below Comments in Build - Gradle (Module App)

The document provides instructions for displaying a PDF in an Android app using the android-pdf-viewer library. It includes adding the library dependency to build.gradle, changing the main activity layout to vertical linear layout and adding a PDFView widget, creating an asset folder, and programmatically loading a PDF from assets into the PDFView.

Uploaded by

Nelson Raja
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Add the below comments in build.

gradle (Module app)

compile 'com.github.barteksc:android-pdf-viewer:3.0.0-beta.5'
2. activity.main.xml

Change the lay out into Linear Layout

And add the android:orientation = ”vertical”

Adding Layout in activity.main.xml in the below codes instead of Text View.


<com.github.barteksc.pdfviewer.PDFView
android:id="@+id/pdfView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
3. create the Asset Folder by Clicking New -> Folder -> Asset Folder

4. Loading the PDF

<com.github.barteksc.pdfviewer.PDFView

android:id="@+id/pdfView"

android:layout_width="match_parent"

android:layout_height="400dp"/>

<user-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'

mPDFView = (PDFView) findViewById(R.id.pdfView);

mPDFView .fromAsset ( assetName: "Nelson_Resume.pdf").load();

// <user-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

You might also like