Android reader

I want to use the Android pdf library http://andpdf.sourceforge.net/ , but I have the same error. Journal:

ST='file 'no file selected' not found' ST='reading page 1, zoom:1.0' 

My classes:

 public class Reader 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; } } 

and

 public class StartScreen extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); Intent intent = new Intent(this, Reader.class); intent.putExtra(PdfViewerActivity.EXTRA_PDFFILENAME, "/sdcard/test.pdf"); startActivity(intent); } } 
+4
source share
3 answers

Some Google codecs have good source code for reading PDF files in android.

Link1

Link2

great example

Link 4

Link 5

+4
source

Now we have this awesome library for viewing PDF:

https://github.com/JoanZapata/android-pdfview

It is really easy to use and has many features:

Android PDFView is a library that provides a fast PDFView component for Android with animations, gestures and zooms. It is based on VuDroid for decoding a PDF file.

Just include the view in your XML and use it like this:

 pdfView.fromAsset(pdfName) .pages(0, 2, 1, 3, 3, 3) .defaultPage(1) .showMinimap(false) .enableSwipe(true) .onDraw(onDrawListener) .onLoad(onLoadCompleteListener) .onPageChange(onPageChangeListener) .load(); 
+1
source

With PdfViewPager you can easily download and display PDF files. All the code you need:

 PdfViewPager pdfViewPager = new PDFViewPager(this, "sample.pdf"); setContentView(pdfViewPager); 

Or you can paste it into your layout as follows:

 <es.voghdev.pdfviewpager.library.PDFViewPager android:id="@+id/pdfViewPager" android:layout_width="match_parent" android:layout_height="match_parent" app:assetFileName="sample.pdf"/> 

Take a look at lib if you want to know more.

0
source

Source: https://habr.com/ru/post/1445510/


All Articles