Skip to content

Commit 624bcea

Browse files
committed
Add new info to README
Update CHANGELOG Update sample.pdf with differend page sizes Update Gradle wrapper version Update version
1 parent 2f35f0f commit 624bcea

File tree

6 files changed

+51
-26
lines changed

6 files changed

+51
-26
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 3.0.0-beta.1 (2017-11-12)
2+
* Add support for documents with different page sizes
3+
* Add support for links
4+
* Add support for defining page fit policy (fit width, height or both)
5+
* Update sample.pdf to contain different page sizes
6+
17
## 2.8.1 (2017-11-11)
28
* Fix bug with rendering `PDFView` in Android Studio Layout Editor
39

README.md

Lines changed: 39 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,26 @@ Library for displaying PDF documents on Android, with `animations`, `gestures`,
1010
It is based on [PdfiumAndroid](https://github.com/barteksc/PdfiumAndroid) for decoding PDF files. Works on API 11 (Android 3.0) and higher.
1111
Licensed under Apache License 2.0.
1212

13-
## What's new in 2.8.0?
14-
* Add handling of invalid pages, inspired by pull request [#433](https://github.com/barteksc/AndroidPdfViewer/pull/433). Exception on page opening crashed application until now,
15-
currently `OnPageErrorListener` set with `Configurator#onPageError()` is called. Invalid page color (`Color` class) can be set using `Configurator#invalidPageColor()`
16-
* Implement `canScrollVertically()` and `canScrollHorizontally()` methods to work e.g. with `SwipeRefreshLayout`
17-
* Fix bug when `Configurator#load()` method was called before view has been measured, which resulted in empty canvas
18-
19-
2.8.1 fixes bug with rendering `PDFView` in Android Studio Layout Editor
20-
21-
## Changes in 2.0 API
22-
* `Configurator#defaultPage(int)` and `PDFView#jumpTo(int)` now require page index (i.e. starting from 0)
23-
* `OnPageChangeListener#onPageChanged(int, int)` is called with page index (i.e. starting from 0)
24-
* removed scrollbar
25-
* added scroll handle as a replacement for scrollbar, use with `Configurator#scrollHandle()`
26-
* added `OnPageScrollListener` listener due to continuous scroll, register with `Configurator#onPageScroll()`
27-
* default scroll direction is vertical, so `Configurator#swipeVertical()` was changed to `Configurator#swipeHorizontal()`
28-
* removed minimap and mask configuration
13+
## What's new in 3.0.0-beta.1?
14+
* Add support for documents with different page sizes
15+
* Add support for links
16+
* Add support for defining page fit policy (fit width, height or both)
17+
* Update sample.pdf to contain different page sizes
18+
19+
## Changes in 3.0 API
20+
* Replaced `Contants.PRELOAD_COUNT` with `PRELOAD_OFFSET`
21+
* Removed `PDFView#fitToWidth()` (variant without arguments)
22+
* Removed `Configurator#invalidPageColor(int)` method as invalid pages are not rendered
23+
* Removed page size parameters from `OnRenderListener#onInitiallyRendered(int)` method, as document may have different page sizes
2924

3025
## Installation
3126

3227
Add to _build.gradle_:
3328

29+
`compile 'com.github.barteksc:android-pdf-viewer:3.0.0-beta.1'`
30+
31+
or if you want to use more stable version:
32+
3433
`compile 'com.github.barteksc:android-pdf-viewer:2.8.1'`
3534

3635
Library is available in jcenter repository, probably it'll be in Maven Central soon.
@@ -82,7 +81,8 @@ pdfView.fromAsset(String)
8281
.enableAntialiasing(true) // improve rendering a little bit on low-res screens
8382
// spacing between pages in dp. To define spacing color, set view background
8483
.spacing(0)
85-
.invalidPageColor(Color.WHITE) // color of page that is invalid and cannot be loaded
84+
.linkHandler(DefaultLinkHandler)
85+
.pageFitPolicy(FitPolicy.WIDTH)
8686
.load();
8787
```
8888

@@ -121,6 +121,25 @@ pdfView.fromAsset(String)
121121
```
122122
Custom providers may be used with `pdfView.fromSource(DocumentSource)` method.
123123

124+
## Links
125+
Version 3.0.0 introduced support for links in PDF documents. By default, **DefaultLinkHandler**
126+
is used and clicking on link that references page in same document causes jump to destination page
127+
and clicking on link that targets some URI causes opening it in default application.
128+
129+
You can also create custom link handlers, just implement **LinkHandler** interface and set it using
130+
`Configurator#linkHandler(LinkHandler)` method. Take a look at [DefaultLinkHandler](https://github.com/barteksc/AndroidPdfViewer/tree/master/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/link/DefaultLinkHandler.java)
131+
source to implement custom behavior.
132+
133+
## Pages fit policy
134+
Since version 3.0.0, library supports fitting pages into the screen in 3 modes:
135+
* WIDTH - width of widest page is equal to screen width
136+
* HEIGHT - height of highest page is equal to screen height
137+
* BOTH - based on widest and highest pages, every page is scaled to be fully visible on screen
138+
139+
Apart from selected policy, every page is scaled to have size relative to other pages.
140+
141+
Fit policy can be set using `Configurator#pageFitPolicy(FitPolicy)`. Default policy is **WIDTH**.
142+
124143
## Additional options
125144

126145
### Bitmap quality
@@ -158,12 +177,12 @@ data cleanup and caching, so creating such module will probably end up as new li
158177
You have to store current page number and then set it with `pdfView.defaultPage(page)`, refer to sample app
159178

160179
### How can I fit document to screen width (eg. on orientation change)?
161-
Use this code snippet:
180+
Use `FitPolicy.WIDTH` policy or add following snippet when you want to fit desired page in document with different page sizes:
162181
``` java
163182
Configurator.onRender(new OnRenderListener() {
164183
@Override
165184
public void onInitiallyRendered(int pages, float pageWidth, float pageHeight) {
166-
pdfView.fitToWidth(); // optionally pass page number
185+
pdfView.fitToWidth(pageIndex);
167186
}
168187
});
169188
```
@@ -175,7 +194,7 @@ If you have any suggestions on making this lib better, write me, create issue or
175194

176195
Created with the help of android-pdfview by [Joan Zapata](http://joanzapata.com/)
177196
```
178-
Copyright 2016 Bartosz Schiller
197+
Copyright 2017 Bartosz Schiller
179198
180199
Licensed under the Apache License, Version 2.0 (the "License");
181200
you may not use this file except in compliance with the License.

android-pdf-viewer/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ext {
1313
siteUrl = 'https://github.com/barteksc/AndroidPdfViewer'
1414
gitUrl = 'https://github.com/barteksc/AndroidPdfViewer.git'
1515

16-
libraryVersion = '2.8.1'
16+
libraryVersion = '3.0.0-beta.1'
1717

1818
developerId = 'barteksc'
1919
developerName = 'Bartosz Schiller'
@@ -32,13 +32,13 @@ android {
3232
minSdkVersion 11
3333
targetSdkVersion 25
3434
versionCode 1
35-
versionName "2.8.1"
35+
versionName "3.0.0-beta.1"
3636
}
3737

3838
}
3939

4040
dependencies {
41-
compile 'com.github.barteksc:pdfium-android:1.7.1'
41+
compile 'com.github.barteksc:pdfium-android:1.8.0'
4242
}
4343

4444
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Tue Oct 31 21:04:38 CET 2017
1+
#Sat Nov 11 23:27:31 CET 2017
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3-all.zip

sample/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ android {
2323
minSdkVersion 11
2424
targetSdkVersion 25
2525
versionCode 3
26-
versionName "2.0.0"
26+
versionName "3.0.0"
2727
}
2828

2929
}

sample/src/main/assets/sample.pdf

661 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)