1 import pdfplumber
2
3 pdf_obj = pdfplumber.open(doc_path)
4 page = pdf_obj.pages[page_no]
5 images_in_page = page.images
6 page_height = page.height
7 image_bbox = (image['x0'], page_height - image['y1'], image['x1'], page_height - image['y0'])
8 cropped_page = page.crop(image_bbox)
9 image_obj = cropped_page.to_image(resolution=400)
10 image_obj.save(path_to_save_image)
11
12
13
14