i using 40 pdf file
See original GitHub issuehi all
i using 40 PDF file
this mean i need to do 40 mainActivity ???
package com.example.androidtabmenucustomizeactionbaritemclick;
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;
public class pdffiel extends Activity implements OnPageChangeListener,OnLoadCompleteListener{
private static final String TAG = pdffiel.class.getSimpleName();
public static final String SAMPLE_FILE = "fasil9.pdf";
PDFView pdfView;
Integer pageNumber = 0;
String pdfFileName;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.pdf);
pdfView= (PDFView)findViewById(R.id.pdfView);
}
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))
.spacing(10)
.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 + "-");
}
}
}
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
How To email large PDF files | Adobe Acrobat
With an online PDF editor, you can compress PDFs up to 2GB in four easy steps: Go to the Acrobat online PDF editor....
Read more >View of Download Complete Issue: 40 (37MB)
Presentation Mode Open Print Download Current View. Go to First Page Go to Last Page. Rotate Clockwise Rotate Counterclockwise. Text Selection Tool
Read more >Have a large PDF? Use these steps to compress your PDF file ...
Any pdf file above 1 MB, which is considered a large file, that is mostly text should be compressed to a smaller size....
Read more >PDF Files - NETT
Create a PDF using the Print command (Windows). 1. Open the file in its authoring application, and choose File > Print. 2. Choose...
Read more >Understanding PDF File Size - Evermap
Explanation of PDF file size and its relationship to use of fonts and images.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I won’t give you example code, it is core Android mechanism, please read Android documentation first.
You have to pass path to PDF document when opening your activity, Android has
Intent
s for such cases