You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+39-20Lines changed: 39 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -10,27 +10,26 @@ Library for displaying PDF documents on Android, with `animations`, `gestures`,
10
10
It is based on [PdfiumAndroid](https://github.com/barteksc/PdfiumAndroid) for decoding PDF files. Works on API 11 (Android 3.0) and higher.
11
11
Licensed under Apache License 2.0.
12
12
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
Library is available in jcenter repository, probably it'll be in Maven Central soon.
@@ -82,7 +81,8 @@ pdfView.fromAsset(String)
82
81
.enableAntialiasing(true) // improve rendering a little bit on low-res screens
83
82
// spacing between pages in dp. To define spacing color, set view background
84
83
.spacing(0)
85
-
.invalidPageColor(Color.WHITE) // color of page that is invalid and cannot be loaded
84
+
.linkHandler(DefaultLinkHandler)
85
+
.pageFitPolicy(FitPolicy.WIDTH)
86
86
.load();
87
87
```
88
88
@@ -121,6 +121,25 @@ pdfView.fromAsset(String)
121
121
```
122
122
Custom providers may be used with `pdfView.fromSource(DocumentSource)` method.
123
123
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
+
124
143
## Additional options
125
144
126
145
### Bitmap quality
@@ -158,12 +177,12 @@ data cleanup and caching, so creating such module will probably end up as new li
158
177
You have to store current page number and then set it with `pdfView.defaultPage(page)`, refer to sample app
159
178
160
179
### 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:
0 commit comments