Skip to content

Overlay/Watermark support #14

@rohan-paudel

Description

@rohan-paudel

.onDrawAll{ canvas, pageWidth, pageHeight, displayedPage ->

                val pngResourceId = R.drawable.only_tejilo

                val originalBitmap: Bitmap = BitmapFactory.decodeResource(resources, pngResourceId)

                val alpha = 50 // Set alpha value (0-255); 0 is fully transparent, 255 is fully opaque
                val transparentBitmap: Bitmap = adjustAlpha(originalBitmap, alpha)!!

                // Set width and height for the Bitmap
                val desiredWidth = 313
                val desiredHeight = 160
                val resizedBitmap: Bitmap = Bitmap.createScaledBitmap(transparentBitmap, desiredWidth, desiredHeight, true)

                val left = (pageWidth - resizedBitmap.width) / 2
                val top = (pageHeight - resizedBitmap.height) / 2
                // Draw the PNG bitmap on the canvas
                canvas?.drawBitmap(resizedBitmap, left, top, null)

            }

i want to like this to draw watermark above pdf in the middle of the page

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions