question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

i using 40 pdf file

See original GitHub issue

hi 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:closed
  • Created 6 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
barteksccommented, Jul 12, 2017

I won’t give you example code, it is core Android mechanism, please read Android documentation first.

2reactions
barteksccommented, Jul 11, 2017

You have to pass path to PDF document when opening your activity, Android has Intents for such cases

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found