def pdf_to_img(pdf_file, page_num, page_width, page_height):
    """
    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
    """
    img = Image(filename="{}[{}]".format(pdf_file, page_num - 1))
    img.resize(page_width, page_height)
    return img
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