To define spacing color, set view background enableAntialiasing( true) // improve rendering a little bit on low-res screens // spacing between pages in dp. enableAnnotationRendering( false) // render annotations (such as comments, colors or forms) onRender(onRenderListener) // called after document is rendered for the first time // called on single tap, return true if handled, false to toggle scroll handle visibility onLoad(onLoadCompleteListener) // called after document is loaded and starts to be rendered allows to draw something on all pages, separately for every page. allows to draw something on the current page, usually visible in the middle of the screen enableSwipe( true) // allows to block changing pages using swipe pages( 0, 2, 1, 3, 3, 3) // all pages are displayed by default
#Android set pdf default code#
fromStream( InputStream) // stream is written to bytearray - native code cannot use Java Streams or pdfView. Library is available in jcenter repository, probably it'll be in Maven Central soon. Or if you want to use more stable version:Ĭompile ':android-pdf-viewer:2.8.1' Removed page size parameters from OnRenderListener#onInitiallyRendered(int) method, as document may have different page sizesĬompile ':android-pdf-viewer:3.0.0-beta.1'.Removed Configurator#invalidPageColor(int) method as invalid pages are not rendered.
Removed PDFView#fitToWidth() (variant without arguments).
#Android set pdf default update#
Update sample.pdf to contain different page sizes.Add support for defining page fit policy (fit width, height or both).Add support for documents with different page sizes.Works on API 11 (Android 3.0) and higher. It is based on PdfiumAndroid for decoding PDF files. Library for displaying PDF documents on Android, with animations, gestures, zoom and double tap support. Version 1.x uses different engine for drawing document on canvas, so if you don't like 2.x version, try 1.x. AndroidPdfViewer 1.x is available on AndroidPdfViewerV1 repo, where can be developed independently.