def pdf_to_img(pdf_file, page_num, pdf_dim=None):
if not pdf_dim:<EOL><INDENT>pdf_dim = get_pdf_dim(pdf_file)<EOL><DEDENT>page_width, page_height = pdf_dim<EOL>img = Image(filename=f"<STR_LIT>")<EOL>img.resize(page_width, page_height)<EOL>return img<EOL>
Converts pdf file into image
:param pdf_file: path to the pdf file
:param page_num: page number to convert (index starting at 1)
:return: wand image object