项目作者: bhoomit11

项目描述 :
A simple library to show multi ple PDF in swipable layout
高级语言: Java
项目地址: git://github.com/bhoomit11/multipdfswipeview-library.git
创建时间: 2019-07-18T08:30:58Z
项目社区:https://github.com/bhoomit11/multipdfswipeview-library

开源协议:

下载


multipdfswipeview-library

A simple library to show multiple PDF in swipable layout

Step 1. Add the dependency

  1. allprojects {
  2. repositories {
  3. ...
  4. maven { url 'https://jitpack.io' }
  5. }
  6. }

Step 2 Add it in your root build.gradle at the end of repositories:

  1. dependencies {
  2. implementation 'com.github.bhoomit11:multipdfswipeview-library:0.1.1'
  3. }

Put this PDF view in you xml file :

  1. <com.example.multipdfswipeview_library.PDFMultiSwipeView
  2. android:id="@+id/pdfView"
  3. android:layout_width="match_parent"
  4. android:layout_height="match_parent"></com.example.multipdfswipeview_library.PDFMultiSwipeView>

Create config for each PDF file

for online and local PDF file

  1. val pdfView: PDFMultiSwipeView = findViewById(R.id.pdfView)
  2. private val pdfConfigs = ArrayList<PDFConfig>()
  3. // You can add multiple PDF like this
  4. var config = PDFConfig()
  5. config.id = "1" //PDF file ID
  6. config.name = "pdfSample1"
  7. config.pdfUrl = "https://www.antennahouse.com/XSLsample/pdf/sample-link_1.pdf"
  8. config.pdfLocalpath = "" //leave blank if no local path available else put absolute path of a FILE
  9. pdfConfigs.add(config)
  10. ...
  11. pdfView.with(this).build(pdfConfigs, PDFMultiSwipeView.TYPE_ONLINE)
  12. // PDFMultiSwipeView.TYPE_OFFLINE if local path was passed in model

for assets PDF file

  1. private val pdfConfigs = ArrayList<PDFConfig>()
  2. // You can add multiple PDF like this
  3. var config = PDFConfig()
  4. config.id = "2" //PDF file ID
  5. config.name = "pdfSample2"
  6. config.pdfUrl = "" //leave blank
  7. config.pdfLocalpath = "" //leave blank
  8. config.assestFileName = "sample.pdf" //Pass file name of pdf file in asset folder
  9. pdfConfigs.add(config)
  10. ...
  11. pdfView.with(this).build(pdfConfigs, PDFMultiSwipeView.TYPE_ASSET) // TYPE_ASSET if you want to open asset file

Checkout sample for more info.