PDFImageView
Add Images to your pdf
Add Image to your pdf.
PDFImageView
accepts image from resource, as bitmap or from a file (should have permission to read it)
You can set image source in 3 ways:
setImageResource(@DrawableRes int resId)
setImageBitmap(@NonNull Bitmap bitmap)
setImageFile(@NonNull File imageFile)
Example:
Advanced:
You can also use PDFImageView
to render any view to pdf.
Step 1: Get bitmap from view.
Step 2:
Either store images in memory and use
setImageBitmap(@NonNull Bitmap bitmap)
toPDFImageView
Or if there a lot images, you can save images to disk and use
setImageFile(@NonNull File imageFile)
toPDFImageView
Last updated