[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-4180":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":17,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":23,"hasPages":21,"topics":24,"createdAt":10,"pushedAt":10,"updatedAt":25,"readmeContent":26,"aiSummary":27,"trendingCount":16,"starSnapshotCount":16,"syncStatus":28,"lastSyncTime":29,"discoverSource":30},4180,"AndroidPdfViewer","DImuthuUpe\u002FAndroidPdfViewer","DImuthuUpe","Android view for displaying PDFs rendered with PdfiumAndroid","",null,"Java",8466,2148,215,717,0,1,7,67.2,"Apache License 2.0",false,"master",true,[],"2026-06-12 04:00:21","\n# Change of ownership and looking for contributors!\n\nThe ownership of the project was recently changed and we are actively looking for contributors to bring the project back to track. Please [visit](https:\u002F\u002Fgithub.com\u002FDImuthuUpe\u002FAndroidPdfViewer\u002Fissues\u002F1186)\n\n# Android PdfViewer\n\n__AndroidPdfViewer 1.x is available on [AndroidPdfViewerV1](https:\u002F\u002Fgithub.com\u002Fbarteksc\u002FAndroidPdfViewerV1)\nrepo, where can be developed independently. Version 1.x uses different engine for drawing document on canvas,\nso if you don't like 2.x version, try 1.x.__\n\nLibrary for displaying PDF documents on Android, with `animations`, `gestures`, `zoom` and `double tap` support.\nIt is based on [PdfiumAndroid](https:\u002F\u002Fgithub.com\u002Fbarteksc\u002FPdfiumAndroid) for decoding PDF files. Works on API 11 (Android 3.0) and higher.\nLicensed under Apache License 2.0.\n\n## What's new in 3.2.0-beta.1?\n* Merge PR #714 with optimized page load\n* Merge PR #776 with fix for max & min zoom level\n* Merge PR #722 with fix for showing right position when view size changed\n* Merge PR #703 with fix for too many threads\n* Merge PR #702 with fix for memory leak\n* Merge PR #689 with possibility to disable long click\n* Merge PR #628 with fix for hiding scroll handle\n* Merge PR #627 with `fitEachPage` option\n* Merge PR #638 and #406 with fixed NPE\n* Merge PR #780 with README fix\n* Update compile SDK and support library to 28\n* Update Gradle and Gradle Plugin\n* **16 KB Page Size Support**: Updated for Google Play compatibility requirement (November 1st, 2025)\n\n## Changes in 3.0 API\n* Replaced `Contants.PRELOAD_COUNT` with `PRELOAD_OFFSET`\n* Removed `PDFView#fitToWidth()` (variant without arguments)\n* Removed `Configurator#invalidPageColor(int)` method as invalid pages are not rendered\n* Removed page size parameters from `OnRenderListener#onInitiallyRendered(int)` method, as document may have different page sizes\n* Removed `PDFView#setSwipeVertical()` method\n\n## Installation\n\nAdd to _build.gradle_:\n\n`implementation 'com.github.barteksc:android-pdf-viewer:3.2.0-beta.1'`\n\nor if you want to use more stable version:\n \n`implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'`\n\nLibrary is available in jcenter repository, probably it'll be in Maven Central soon.\n\n## 16 KB Page Size Support ✅ FIXED\n\n**✅ RESOLVED**: This library has been updated and **successfully fixed** to support 16 KB page sizes for Google Play compatibility. Starting November 1st, 2025, all new apps and updates targeting Android 15+ must support 16 KB page sizes.\n\n### ✅ What Was Fixed:\n- **Issue**: The `pdfium-android:1.9.0` dependency contained prebuilt native libraries that were not aligned for 16 KB page sizes\n- **Solution**: Implemented compressed shared libraries configuration and post-build realignment scripts\n- **Result**: APK now passes all 16 KB alignment checks and is Google Play compliant\n\n### Key Updates Made:\n- **AGP Version**: Using 8.13.0 (above required 8.5.1)\n- **NDK Version**: Updated to r28+ for 16 KB support\n- **Packaging**: Configured for compressed shared libraries to avoid alignment issues\n- **Native Libraries**: All native libraries are properly aligned for 16 KB page sizes\n- **Realignment Scripts**: Added automated tools to fix alignment issues\n\n### ✅ Verification:\nUse the provided scripts to verify 16 KB alignment:\n- **Linux\u002FmacOS**: `.\u002Fcheck_16kb_alignment.sh your-app.apk`\n- **Windows**: `.\\check_16kb_alignment.ps1 -ApkFile \"your-app.apk\"`\n- **Fix Alignment**: `.\\realign_apk.bat \"your-app.apk\"`\n\n### 🎉 Google Play Compliance:\nYour app will now **pass Google Play's 16 KB compatibility checks** and work on devices with 16 KB page sizes.\n\nFor more details, see [16KB_SUPPORT.md](16KB_SUPPORT.md).\n\n## ProGuard\nIf you are using ProGuard, add following rule to proguard config file:\n\n```proguard\n-keep class com.shockwave.**\n```\n\n## Include PDFView in your layout\n\n``` xml\n\u003Ccom.github.barteksc.pdfviewer.PDFView\n        android:id=\"@+id\u002FpdfView\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\u002F>\n```\n\n## Load a PDF file\n\nAll available options with default values:\n``` java\npdfView.fromUri(Uri)\nor\npdfView.fromFile(File)\nor\npdfView.fromBytes(byte[])\nor\npdfView.fromStream(InputStream) \u002F\u002F stream is written to bytearray - native code cannot use Java Streams\nor\npdfView.fromSource(DocumentSource)\nor\npdfView.fromAsset(String)\n    .pages(0, 2, 1, 3, 3, 3) \u002F\u002F all pages are displayed by default\n    .enableSwipe(true) \u002F\u002F allows to block changing pages using swipe\n    .swipeHorizontal(false)\n    .enableDoubletap(true)\n    .defaultPage(0)\n    \u002F\u002F allows to draw something on the current page, usually visible in the middle of the screen\n    .onDraw(onDrawListener)\n    \u002F\u002F allows to draw something on all pages, separately for every page. Called only for visible pages\n    .onDrawAll(onDrawListener)\n    .onLoad(onLoadCompleteListener) \u002F\u002F called after document is loaded and starts to be rendered\n    .onPageChange(onPageChangeListener)\n    .onPageScroll(onPageScrollListener)\n    .onError(onErrorListener)\n    .onPageError(onPageErrorListener)\n    .onRender(onRenderListener) \u002F\u002F called after document is rendered for the first time\n    \u002F\u002F called on single tap, return true if handled, false to toggle scroll handle visibility\n    .onTap(onTapListener)\n    .onLongPress(onLongPressListener)\n    .enableAnnotationRendering(false) \u002F\u002F render annotations (such as comments, colors or forms)\n    .password(null)\n    .scrollHandle(null)\n    .enableAntialiasing(true) \u002F\u002F improve rendering a little bit on low-res screens\n    \u002F\u002F spacing between pages in dp. To define spacing color, set view background\n    .spacing(0)\n    .autoSpacing(false) \u002F\u002F add dynamic spacing to fit each page on its own on the screen\n    .linkHandler(DefaultLinkHandler)\n    .pageFitPolicy(FitPolicy.WIDTH) \u002F\u002F mode to fit pages in the view\n    .fitEachPage(false) \u002F\u002F fit each page to the view, else smaller pages are scaled relative to largest page.\n    .pageSnap(false) \u002F\u002F snap pages to screen boundaries\n    .pageFling(false) \u002F\u002F make a fling change only a single page like ViewPager\n    .nightMode(false) \u002F\u002F toggle night mode\n    .load();\n```\n\n* `pages` is optional, it allows you to filter and order the pages of the PDF as you need\n\n## Scroll handle\n\nScroll handle is replacement for **ScrollBar** from 1.x branch.\n\nFrom version 2.1.0 putting **PDFView** in **RelativeLayout** to use **ScrollHandle** is not required, you can use any layout.\n\nTo use scroll handle just register it using method `Configurator#scrollHandle()`.\nThis method accepts implementations of **ScrollHandle** interface.\n\nThere is default implementation shipped with AndroidPdfViewer, and you can use it with\n`.scrollHandle(new DefaultScrollHandle(this))`.\n**DefaultScrollHandle** is placed on the right (when scrolling vertically) or on the bottom (when scrolling horizontally).\nBy using constructor with second argument (`new DefaultScrollHandle(this, true)`), handle can be placed left or top.\n\nYou can also create custom scroll handles, just implement **ScrollHandle** interface.\nAll methods are documented as Javadoc comments on interface [source](https:\u002F\u002Fgithub.com\u002Fbarteksc\u002FAndroidPdfViewer\u002Ftree\u002Fmaster\u002Fandroid-pdf-viewer\u002Fsrc\u002Fmain\u002Fjava\u002Fcom\u002Fgithub\u002Fbarteksc\u002Fpdfviewer\u002Fscroll\u002FScrollHandle.java).\n\n## Document sources\nVersion 2.3.0 introduced _document sources_, which are just providers for PDF documents.\nEvery provider implements **DocumentSource** interface.\nPredefined providers are available in **com.github.barteksc.pdfviewer.source** package and can be used as\nsamples for creating custom ones.\n\nPredefined providers can be used with shorthand methods:\n```\npdfView.fromUri(Uri)\npdfView.fromFile(File)\npdfView.fromBytes(byte[])\npdfView.fromStream(InputStream)\npdfView.fromAsset(String)\n```\nCustom providers may be used with `pdfView.fromSource(DocumentSource)` method.\n\n## Links\nVersion 3.0.0 introduced support for links in PDF documents. By default, **DefaultLinkHandler**\nis used and clicking on link that references page in same document causes jump to destination page\nand clicking on link that targets some URI causes opening it in default application.\n\nYou can also create custom link handlers, just implement **LinkHandler** interface and set it using\n`Configurator#linkHandler(LinkHandler)` method. Take a look at [DefaultLinkHandler](https:\u002F\u002Fgithub.com\u002Fbarteksc\u002FAndroidPdfViewer\u002Ftree\u002Fmaster\u002Fandroid-pdf-viewer\u002Fsrc\u002Fmain\u002Fjava\u002Fcom\u002Fgithub\u002Fbarteksc\u002Fpdfviewer\u002Flink\u002FDefaultLinkHandler.java)\nsource to implement custom behavior.\n\n## Pages fit policy\nSince version 3.0.0, library supports fitting pages into the screen in 3 modes:\n* WIDTH - width of widest page is equal to screen width\n* HEIGHT - height of highest page is equal to screen height\n* BOTH - based on widest and highest pages, every page is scaled to be fully visible on screen\n\nApart from selected policy, every page is scaled to have size relative to other pages.\n\nFit policy can be set using `Configurator#pageFitPolicy(FitPolicy)`. Default policy is **WIDTH**.\n\n## Additional options\n\n### Bitmap quality\nBy default, generated bitmaps are _compressed_ with `RGB_565` format to reduce memory consumption.\nRendering with `ARGB_8888` can be forced by using `pdfView.useBestQuality(true)` method.\n\n### Double tap zooming\nThere are three zoom levels: min (default 1), mid (default 1.75) and max (default 3). On first double tap,\nview is zoomed to mid level, on second to max level, and on third returns to min level.\nIf you are between mid and max levels, double tapping causes zooming to max and so on.\n\nZoom levels can be changed using following methods:\n\n``` java\nvoid setMinZoom(float zoom);\nvoid setMidZoom(float zoom);\nvoid setMaxZoom(float zoom);\n```\n\n## Possible questions\n### Why resulting apk is so big?\nAndroid PdfViewer depends on PdfiumAndroid, which is set of native libraries (almost 16 MB) for many architectures.\nApk must contain all this libraries to run on every device available on market.\nFortunately, Google Play allows us to upload multiple apks, e.g. one per every architecture.\nThere is good article on automatically splitting your application into multiple apks,\navailable [here](http:\u002F\u002Fph0b.com\u002Fandroid-studio-gradle-and-ndk-integration\u002F).\nMost important section is _Improving multiple APKs creation and versionCode handling with APK Splits_, but whole article is worth reading.\nYou only need to do this in your application, no need for forking PdfiumAndroid or so.\n\n### Why I cannot open PDF from URL?\nDownloading files is long running process which must be aware of Activity lifecycle, must support some configuration, \ndata cleanup and caching, so creating such module will probably end up as new library.\n\n### How can I show last opened page after configuration change?\nYou have to store current page number and then set it with `pdfView.defaultPage(page)`, refer to sample app\n\n### How can I fit document to screen width (eg. on orientation change)?\nUse `FitPolicy.WIDTH` policy or add following snippet when you want to fit desired page in document with different page sizes:\n``` java\nConfigurator.onRender(new OnRenderListener() {\n    @Override\n    public void onInitiallyRendered(int pages, float pageWidth, float pageHeight) {\n        pdfView.fitToWidth(pageIndex);\n    }\n});\n```\n\n### How can I scroll through single pages like a ViewPager?\nYou can use a combination of the following settings to get scroll and fling behaviour similar to a ViewPager:\n``` java\n    .swipeHorizontal(true)\n    .pageSnap(true)\n    .autoSpacing(true)\n    .pageFling(true)\n```\n\n## One more thing\nIf you have any suggestions on making this lib better, write me, create issue or write some code and send pull request.\n\n## License\n\nCreated with the help of android-pdfview by [Joan Zapata](http:\u002F\u002Fjoanzapata.com\u002F)\n```\nCopyright 2017 Bartosz Schiller\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http:\u002F\u002Fwww.apache.org\u002Flicenses\u002FLICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","AndroidPdfViewer 是一个用于在 Android 应用中显示 PDF 文档的库，基于 PdfiumAndroid 解码 PDF 文件。该项目支持动画、手势操作、缩放及双击功能，并且能在 API 11（Android 3.0）及以上版本运行。它具有高效的页面加载优化、内存泄漏修复以及对16KB页面大小的支持等特性，确保了良好的性能和兼容性。适用于需要在移动应用中嵌入PDF阅读功能的各种场景，如电子书阅读器、文档查看器等。项目采用Apache License 2.0授权，鼓励社区贡献以持续改进。",2,"2026-06-11 02:58:52","top_language"]