How to convert pdf file into app in android studio

How to convert pdf file into app in android studio

How to convert pdf file into the app in android studio

Gradule: implementation ‘com.github.barteksc:android-pdf-viewer:2.8.2’



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

</com.github.barteksc.pdfviewer.PDFView>



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

PDFView pdfView;


PDFView pdfView= (PDFView) findViewById(R.id.pdfbook);
pdfView.fromAsset("Quran e Paak.pdf").load();




manifest


<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"    package="com.example.quranepaak">
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"></uses-permission>

<application android:allowBackup=”true” android:icon=”@mipmap/ic_launcher” android:label=”@string/app_name” android:roundIcon=”@mipmap/ic_launcher_round” android:supportsRtl=”true” android:theme=”@style/AppTheme”>
<activity android:name=”.MainActivity”>
<intent-filter>
<action android:name=”android.intent.action.MAIN” />

<category android:name=”android.intent.category.LAUNCHER” />
</intent-filter>
</activity>
</application>

</manifest>
























main-activity

package com.example.quranepaak;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

import com.github.barteksc.pdfviewer.PDFView;

public class MainActivity extends AppCompatActivity {
PDFView pdfView;

@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
PDFView pdfView= (PDFView) findViewById(R.id.pdfbook);
pdfView.fromAsset(“Quran e Paak.pdf”).load();
}
}






activity-main-xml

<?xml version="1.0" encoding="utf-8"?><androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:app="http://schemas.android.com/apk/res-auto"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent"    tools:context=".MainActivity">
    <com.github.barteksc.pdfviewer.PDFView        android:layout_width="match_parent"        android:layout_height="match_parent"        android:id="@+id/pdfbook">

</com.github.barteksc.pdfviewer.PDFView>










Leave a Reply

%d bloggers like this: