DImuthuUpe / AndroidPdfViewer

Android view for displaying PDFs rendered with PdfiumAndroid
Apache License 2.0
8.13k stars 1.89k forks source link

Help needed #537

Open zainulaabdin opened 6 years ago

zainulaabdin commented 6 years ago

Hi, thank you very much for such a great library, it is very useful and working nicely for me. The only issue, I see is big apk file. I have a question. Is it possible to render the pdf with a transparent background or with a predefined color? I know pdfView.setBackgroundColor(Color.GREEN); but it just sets the background of the pdfView container but the pdf still shows white background. Thank you very much.

1stmetro commented 6 years ago

The pdf is rendered as an image. You manipulate the image

zainulaabdin commented 6 years ago

@1stmetro, Thank you very much for the reply. I read in several comments that pdf is rendered as an image but I have no clue how to get a reference to the image and change the background color. Basically, I have DayNight Theme in my app and white background is fine for Day theme but does not look good in Night Theme. Please help me to do that. Thank you very much in advance.

1stmetro commented 6 years ago

You can manipulate the view which might be more beneficial to you

1stmetro commented 6 years ago

Out of interest what color do you have in mind for a night view ?

zainulaabdin commented 6 years ago

Thank you very much, 1stmetro. It's a black(NightTheme)/white(DayTheme). I still believe that it would nice if this library can render pdf on a transparent canvas. Thank you.

1stmetro commented 6 years ago

Okay I modded my grey scale view and already did a black before seeing your reply.

Simply you use colormatrix to reverse the pdf view so white becomes black etc. Just paint an overlay ontop and job done.