Skip to content Skip to sidebar Skip to footer

Set Rtl Scroll Direction For Pdfview - Android

I am using one Github library for view PDF file. https://github.com/barteksc/AndroidPdfViewer i want to set scroll direction RTL. please help to change scroll direction of this lib

Solution 1:

I have found a hack. Rotate your pdf by 180 degress and then add following line in your code

pdf_activity_read_quraan.rotation = 180F

where is pdf_activity_read_quraan is reference of com.github.barteksc.pdfviewer.PDFView

Solution 2:

Try adding android:supportsRtl="true" in Application tag of the manifest file.

Source : https://developer.android.com/guide/topics/manifest/application-element.html


Possible workaround would be acquiring the scroll and force move like this :

mScrollView.postDelayed(new Runnable() {
    publicvoidrun() {
        scrollView.fullScroll(HorizontalScrollView.FOCUS_RIGHT); // or scrollTo
    }
}, 100L);

Solution 3:

use onLoad method inside onCreate method like this:

mypdfviewer.fromAsset("Quran.pdf").onLoad(new OnLoadCompleteListener() {
            @Override
            public void loadComplete(int nbPages) {
                mypdfviewer.fromAsset("Quran.pdf")
                        .pages(getPage(nbPages))
                        .defaultPage(nbPages)
                        .enableSwipe(true)
                        .enableDoubletap(true)
                        .swipeHorizontal(true)
                        .password(null).enableAntialiasing ( true ).spacing(0)
                        .pageSnap(true).pageFling(true)
                        .autoSpacing ( false ).pageFitPolicy ( FitPolicy. WIDTH ).fitEachPage ( true )
                        .scrollHandle(new DefaultScrollHandle(null))
                        .load();

            }
        }).load();

**create getPage method **

privateint [] getPage(int nbPages) {
    int [] pages =newint[nbPages];
    int j=0;
    for(int i=pages.length-1; i>=0; i--)
    {
        pages[j]=i;
        j++;
    }
    return  pages;
}

working for me:)

Post a Comment for "Set Rtl Scroll Direction For Pdfview - Android"