pdfview-android
pdfview-android copied to clipboard
Added drawing page borders
Fixes Dmitry-Borodin/pdfview-android #4
A rectangle with coordinates is created and transformed using the same matrix used in rendering the page. Currently all the pages are assumed the same height. So in line 61 the "real" size of the current page is taken. If a page in the middle has different size, page border will be drawn according to it's "real" size. We are lucky that all screen density transitions are made somewhere else, so we need to correct border width only by sampleSize.
I think we should make it optional, at least give a way to opt out. Otherwise it's not backwards compatible. Not sure what should be the default. Will need to add this information to changelog as well. I will think about it over a weekend and probably come with some suggestions.
Border size can be moved to a field and be zero by default. Also checking border size against 0 can be a condition to draw the border.
See commit for details.
I'm thinking of nice API since we will have page numbers et.c.
Something like second parameter "configuration" during initialization, that has default value for backwards compatibility and those who don't want to learn staff. And if you do want - it's easy to see what configuration options are available and what they mean just because of clear names
fromAsset("file.pdf").show(config = PdfConfig(borders = THIN, showPage = true))
At the same time if page numbers will be provided by callback and we can just check if it's null - we won't need it
I'm mainly thinking of situation when we just add one thing with thckness where 0 will mean no borders, then only callback where null means pages disabled And it's already not clear how to configure stuff for people, who just want to show pdf and don't dig in. Any thought are welcome.