We're using v3.4 in one of our application.
It seems that results of the PDF renderer depend on how we erase the bitmap before rendering PDF pages to it in an odd way.
If we erase the bitmap with 0x00000000 (in our app, PDF images usually have alpha, so we need to erase the
bitmap with this value to preserve the transparency), the rendered bitmap itself often looks fine, but when we draw it on top of another
layer, the blending is weird. More interestingly, if we save the rendered bitmap to a PNG file and then decode it back, the
new bitmap looks very different from the original one. See the attached sample project, when we try to render the file file1.pdf.
If we try to erase the bitmap with another color, e.g. 0x7f050000 in the sample project, the weird blending and PNG image
disappear, but it increases the opacity of the bitmap. It also doesn't work in all cases, for example, with the PDF file
file2.pdf in our sample, the bitmap must be erased with 0x00000000 for the renderer to works correctly.
Steps to reproduce:
- Copy 2 files file1.pdf and file2.pdf to /sdcard/
- Run the sample project: result is the bitmap rendered from file1.pdf being drawn on top of a blue layer
- Change the erase color value in PDFSimple#render_page() from 0x00000000 to 0x7f050000 to see the difference in blending
and PNG image.
- Change the fileName in PDFSimpleAct#init() to FILE_2 and do the 2 steps above.
******* The sample project can be downloaded herer:
www.notabasement.com/files/PDFReader.zip