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
Library is available in jcenter repository, probably it'll be in Maven Central soon.
65
83
66
84
## ProGuard
85
+
67
86
If you are using ProGuard, add following rule to proguard config file:
68
87
69
88
```proguard
@@ -82,6 +101,7 @@ If you are using ProGuard, add following rule to proguard config file:
82
101
## Load a PDF file
83
102
84
103
All available options with default values:
104
+
85
105
```java
86
106
pdfView.fromUri(Uri)
87
107
or
@@ -134,46 +154,56 @@ pdfView.fromAsset(String)
134
154
135
155
Scroll handle is replacement for **ScrollBar** from 1.x branch.
136
156
137
-
From version 2.1.0 putting **PDFView** in **RelativeLayout** to use **ScrollHandle** is not required, you can use any layout.
157
+
From version 2.1.0 putting **PDFView** in **RelativeLayout** to use **ScrollHandle** is not required, you can use any
158
+
layout.
138
159
139
160
To use scroll handle just register it using method `Configurator#scrollHandle()`.
140
161
This method accepts implementations of **ScrollHandle** interface.
141
162
142
163
There is default implementation shipped with AndroidPdfViewer, and you can use it with
143
164
`.scrollHandle(new DefaultScrollHandle(this))`.
144
-
**DefaultScrollHandle** is placed on the right (when scrolling vertically) or on the bottom (when scrolling horizontally).
165
+
**DefaultScrollHandle** is placed on the right (when scrolling vertically) or on the bottom (when scrolling
166
+
horizontally).
145
167
By using constructor with second argument (`new DefaultScrollHandle(this, true)`), handle can be placed left or top.
146
168
147
169
You can also create custom scroll handles, just implement **ScrollHandle** interface.
148
-
All methods are documented as Javadoc comments on interface [source](https://github.com/barteksc/AndroidPdfViewer/tree/master/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/scroll/ScrollHandle.java).
Version 2.3.0 introduced _document sources_, which are just providers for PDF documents.
152
176
Every provider implements **DocumentSource** interface.
153
177
Predefined providers are available in **com.github.barteksc.pdfviewer.source** package and can be used as
154
178
samples for creating custom ones.
155
179
156
180
Predefined providers can be used with shorthand methods:
181
+
157
182
```
158
183
pdfView.fromUri(Uri)
159
184
pdfView.fromFile(File)
160
185
pdfView.fromBytes(byte[])
161
186
pdfView.fromStream(InputStream)
162
187
pdfView.fromAsset(String)
163
188
```
189
+
164
190
Custom providers may be used with `pdfView.fromSource(DocumentSource)` method.
165
191
166
192
## Links
193
+
167
194
Version 3.0.0 introduced support for links in PDF documents. By default, **DefaultLinkHandler**
168
195
is used and clicking on link that references page in same document causes jump to destination page
169
196
and clicking on link that targets some URI causes opening it in default application.
170
197
171
198
You can also create custom link handlers, just implement **LinkHandler** interface and set it using
172
-
`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)
199
+
`Configurator#linkHandler(LinkHandler)` method. Take a look
200
+
at [DefaultLinkHandler](https://github.com/barteksc/AndroidPdfViewer/tree/master/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/link/DefaultLinkHandler.java)
173
201
source to implement custom behavior.
174
202
175
203
## Pages fit policy
204
+
176
205
Since version 3.0.0, library supports fitting pages into the screen in 3 modes:
206
+
177
207
* WIDTH - width of widest page is equal to screen width
178
208
* HEIGHT - height of highest page is equal to screen height
179
209
* BOTH - based on widest and highest pages, every page is scaled to be fully visible on screen
@@ -185,10 +215,12 @@ Fit policy can be set using `Configurator#pageFitPolicy(FitPolicy)`. Default pol
185
215
## Additional options
186
216
187
217
### Bitmap quality
218
+
188
219
By default, generated bitmaps are _compressed_ with `RGB_565` format to reduce memory consumption.
189
220
Rendering with `ARGB_8888` can be forced by using `pdfView.useBestQuality(true)` method.
190
221
191
222
### Double tap zooming
223
+
192
224
There are three zoom levels: min (default 1), mid (default 1.75) and max (default 3). On first double tap,
193
225
view is zoomed to mid level, on second to max level, and on third returns to min level.
194
226
If you are between mid and max levels, double tapping causes zooming to max and so on.
0 commit comments