Answers for "get coordinates of an image from a pdf python"

0

get coordinates of an image from a pdf python

import pdfplumber

    pdf_obj = pdfplumber.open(doc_path)
    page = pdf_obj.pages[page_no]
    images_in_page = page.images
    page_height = page.height
    image_bbox = (image['x0'], page_height - image['y1'], image['x1'], page_height - image['y0'])
    cropped_page = page.crop(image_bbox)
    image_obj = cropped_page.to_image(resolution=400)
    image_obj.save(path_to_save_image)
Posted by: Guest on November-05-2020

Code answers related to "get coordinates of an image from a pdf python"

Python Answers by Framework

Browse Popular Code Answers by Language