from poppler import load_from_file, PageRenderer pdf_document = load_from_file("sample.pdf") page_1 = pdf_document.create_page(0) page_1_text = page_1.text() renderer = PageRenderer() image = renderer.render_page(page_1) image_data = image.data