I'm working on a project where I need to display PDF content inside our application. I'm trying to use PdfRenderer of Android API. For now, I'm able to show a pdf page as bitmap and move between all other pages.
But I don't understand how to implement zoom on a page. I mean I know how to zoom an image, but for pdf it needs to be recalculated at every zoom level (such as tile ?). On zoom I need to recalculate Bitmap with correct Rect and Matrix I guess, that's the point I'm missing.
Does some one has already done this or similar ?
PS: I want to make it by my own but feel free to send me opensource library thanks
PdfRenderer
,PdfRenderer
is a poor choice, as it will fail to render many PDF files. Use something else. – CicalaPdfRenderer
a good choice, when compared to other in-process solutions, such as those that I linked to in my previous comment. But, FWIW, this sample app demonstrates usingSubsamplingScaleImageView
withPdfRenderer
for pinch-zoom capability. – CicalaSubsamplingScaleImageView
works back to API Level 14.PdfRenderer
is only available for API Level 21+. – CicalaViewPager
. The whole sample is about 200 lines of Java code. "If not, any suggestion for that?" -- possiblyViewPager2
, since it supports vertical pages. – CicalaViewPager2
is built onRecyclerView
). "But I reverted to HTML" -- yeah,WebView
is way easier, if you're in position to back away slowly from PDF. – Cicala