Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added drawing page borders #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mspnr
Copy link
Contributor

@mspnr mspnr commented Aug 12, 2020

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.

@Dmitry-Borodin
Copy link
Owner

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.

@mspnr
Copy link
Contributor Author

mspnr commented Aug 15, 2020

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.

@Dmitry-Borodin
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants