How to read custom pdf in android?

Step 1 :  create activity in src folder.

import net.sf.andpdf.pdfviewer.PdfViewerActivity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;

public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

try{
Intent intent = new Intent(this, MyPdfViewerActivity.class);
intent.putExtra(PdfViewerActivity.EXTRA_PDFFILENAME,filepath);
startActivity(intent);
}catch(Exception e){
Log.w(“Exception”, “”+e.getMessage());
}
}

 

step 2 : add more java file in src folder.

import net.sf.andpdf.pdfviewer.PdfViewerActivity;

public class MyPdfViewerActivity extends PdfViewerActivity {

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;
}
}

 

step 3 : add jar file in your lib folder.

pdfviewer