You can also create custom link handlers, just implement LinkHandler interface and set it usingĬonfigurator#linkHandler(LinkHandler) method. Is used and clicking on link that references page in same document causes jump to destination pageĪnd clicking on link that targets some URI causes opening it in default application. Version 3.0.0 introduced support for links in PDF documents. Predefined providers can be used with shorthand methods:Ĭustom providers may be used with omSource(DocumentSource) method. Predefined providers are available in .source package and can be used as Version 2.3.0 introduced document sources, which are just providers for PDF documents.Įvery provider implements DocumentSource interface. You can also create custom scroll handles, just implement ScrollHandle interface.Īll methods are documented as Javadoc comments on interface source. scrollHandle(new DefaultScrollHandle(this)).ĭefaultScrollHandle is placed on the right (when scrolling vertically) or on the bottom (when scrolling horizontally).īy using constructor with second argument ( new DefaultScrollHandle(this, true)), handle can be placed left or top. There is default implementation shipped with AndroidPdfViewer, and you can use it with This method accepts implementations of ScrollHandle interface. To use scroll handle just register it using method Configurator#scrollHandle(). Scroll handle is replacement for ScrollBar from 1.x branch.įrom version 2.1.0 putting PDFView in RelativeLayout to use ScrollHandle is not required, you can use any layout. pages is optional, it allows you to filter and order the pages of the PDF as you need.pageFling( false) // make a fling change only a single page like ViewPager pageSnap( false) // snap pages to screen boundaries fitEachPage( false) // fit each page to the view, else smaller pages are scaled relative to largest page. autoSpacing( false) // add dynamic spacing to fit each page on its own on the screen 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 fromStream( InputStream) // stream is written to bytearray - native code cannot use Java Streams or pdfView. If you are using ProGuard, add following rule to proguard config file: Library is available in jcenter repository, probably it'll be in Maven Central soon. Implementation ':android-pdf-viewer:2.8.2' Or if you want to use more stable version: Implementation ':android-pdf-viewer:3.2.0-beta.1' Removed PDFView#setSwipeVertical() method.Removed page size parameters from OnRenderListener#onInitiallyRendered(int) method, as document may have different page sizes.Removed Configurator#invalidPageColor(int) method as invalid pages are not rendered.Removed PDFView#fitToWidth() (variant without arguments).Replaced Contants.PRELOAD_COUNT with PRELOAD_OFFSET.Update compile SDK and support library to 28.Merge PR #628 with fix for hiding scroll handle.Merge PR #689 with possibility to disable long click. ![]() Merge PR #703 with fix for too many threads.Merge PR #722 with fix for showing right position when view size changed.Merge PR #776 with fix for max & min zoom level.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. So if you don't like 2.x version, try 1.x. Version 1.x uses different engine for drawing document on canvas, Repo, where can be developed independently. Looking for new maintainer! Android PdfViewerĪndroidPdfViewer 1.x is available on AndroidPdfViewerV1
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |