This video explains explicitly on how to set up a document scanning application in Android. The flow is users could select image from gallery or take a snapshot using the device camera and convert images to PDF which is further saved as a file to device internal storage.
Get source here: https://github.com/delaroy/Image2Pdf