PDF From Network (Viger PDF)

Additional

Language
Java
Version
2.0 (Oct 8, 2020)
Created
Oct 8, 2020
Updated
Oct 22, 2020 (Retired)
Owner
NecisStudio
Contributors
Anna arthdi putra (aerdy)
NecisStudio
2
Activity
Badge
Generate
Download
Source code

Viger - View Pager PDF OpenSource

Viger PDF How to Works is file pdf extract or convert to bitmap use Library Vudroid was write C Language, after that images include to adapter viewpager

Download

Gradle:

 allprojects {
  repositories {
   ...
   maven { url 'https://jitpack.io' }
  }
 }
dependencies {
        implementation 'com.github.NecisStudio:VigerV2:2.1'
 }

Support Android Version

        minSdkVersion 15

Library Support Open Source PDF and Connection

  • Vudroid Library PDF
  • Retrofit 2 Get Stream Connection

Support Vertical Swap and Horizontal Swap

    <com.necistudio.vigerpdf.utils.ViewPagerZoomHorizontal
        android:id="@+id/viewPager"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <com.necistudio.vigerpdf.utils.ViewPagerZoomVertical
        android:id="@+id/viewPager"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

Support Get PDF From URL

private void fromNetwork(String endpoint) {
        new VigerPDF(this, endpoint).initFromFile(new OnResultListener() {
            @Override
            public void resultData(byte[] data) {
                Log.e("data", "run");
                itemDataV2.add(data);
            }

            @Override
            public void progressData(int progress) {
                Log.e("data", "" + progress);
            }

            @Override
            public void failed(Throwable t) {
                Log.e("error", " : " + t.getMessage());
                progressDialog.dismiss();
                Toast.makeText(MainActivity.this, t.getMessage(), Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onComplete() {
                progressDialog.dismiss();
                adapterV2.notifyDataSetChanged();
            }
        });
    }

Supprt Get PDF From File

 private void fromFile(String path) {
        File file = new File(path);
        new VigerPDF(this, file).initFromFile(new OnResultListener() {
            @Override
            public void resultData(ArrayList<Bitmap> data) {
                VigerAdapter adapter = new VigerAdapter(getApplicationContext(),data);
                viewPager.setAdapter(adapter);
            }
            @Override
            public void progressData(int progress) {
                Log.e("data", "" + progress);

            }

            @Override
            public void failed(Throwable t) {
                Log.e("error", " : " + t.getMessage());
                progressDialog.dismiss();
                Toast.makeText(MainActivity.this, t.getMessage(), Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onComplete() {
                progressDialog.dismiss();
                adapterV2.notifyDataSetChanged();
            }
        });
    }

Contributor

License

    Copyright (C) 2020  Necis Studio

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as
    published by the Free Software Foundation, either version 3 of the
    License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.