Finally, I came up with a solution with which I can work.
Using pypdfocr and its pypdfocr_gs library, I call
pypdfocr.pypdfocr_gs.PyGs({}).make_img_from_pdf(pdf_file)
jpg-, PIL ImageTk.PhotoImage .
ImageTk.PhotoImage(_img_file_handle)
, .
Edit:
,
import pypdfocr.pypdfocr_gs as pdfImg
from PIL import Image, ImageTk
import Tkinter as tk
import ttk
import glob, os
root=tk.Tk()
__f_tmp=glob.glob(pdfImg.PyGs({}).make_img_from_pdf("\tmp\test.pdf")[1])[0]
__img=Image.open(__f_tmp)
__tk_img=ImageTk.PhotoImage(__img)
ttk.Label(root, image=__tk_img).grid()
__img.close()
os.remove(__f_tmp)
root.mainloop()
Edit:
viranthas pypdfocr, , Windows 10 pythons:
def _run_gs(self, options, output_filename, pdf_filename):
try:
cmd = '%s -q -dNOPAUSE %s -sOutputFile="%s" "%s" -c quit' % (self.binary, options, output_filename, pdf_filename)
logging.info(cmd)
out = subprocess.check_output(cmd)