I have a PDF file where each page is a different height. The library seems to create a viewport as large as the largest page which then the smaller pages have a large amount of empty space above and below the page which is centred in the page.. Any advice? (This issue exists on both Android and iOS)
Thank you for your help nermeen. I have managed to make this work on android by using a combination of align_page_top setting and and array of values instead of using the m_th variable. However, I have been having issues with the iOS implementation. it seems to not have the align_page_top flag and I assume that I will just create an array to replace the variable m_doch. Any advice to make the pdfs align top?
we are using the Android library, it has been added 2-3 years ago and we haven't touched it since. Standard license.
You are saying we should modifying the vLayout method of the appropriate layout mode.
However, I can find this method with an empty body in PdfView class, and no class extends or implements it in the library or my project.
I also read elsewhere that we could change Global. def_view in order to get different default view modes - I want to fit to width.
I tried all values and nothing changed.
I noticed you're using PdfView. The latest library uses PDFLayoutVew, as PdfView is now deprecated. PDFLayoutView does not have a way currently that I've found to set the page scale to fix the issue of certain pages not filling the screen due to scaling. When using PDFLayoutView.PDFSetView(3), that should fix up Global.def_view to match Single page view mode, which is great, but certain pages still aren't scaling into view properly if the PDF has pages that aren't the same size.
To solve this problem, I used the PDFViewPager instead of the PDFLayoutView, which has the ability to open a PDF using the following code snippet.
This opens the PDF as normal, but fits it to fill the screen regardless of page size. You can extend the PDFViewPager to add in functionality that you need, such as registering an OnPageChangeListener as normal for a ViewPager to track page turns, etc. I strongly suggest using the PDFViewPager rather than PDFLayoutView if you need to display a PDF page by page with each page fit to screen individually.