.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
.onDrawAll{ canvas, pageWidth, pageHeight, displayedPage ->
i want to like this to draw watermark above pdf in the middle of the page