Exemple #1
0
def get_paths():
    '''Locates files and creates PDF objects.'''
    path = os.getcwd()
    file_path = os.path.join(path, 'practice_files/half and half.pdf')
    pdf_in = pdr(file(file_path, 'rb'))
    pdf_out = pdw()
    return path, pdf_in, pdf_out
def summary():
    """Does all the things to do the stuff."""
    path = get_file_path()
    input_pdf = pdr(file(path, "rb"))
    title, author, page_num = get_info(input_pdf)
    display_info(title, author, page_num)
    pdf_out, txt_out = get_out_paths()
    write_txt_file(input_pdf, txt_out, page_num)
    write_pdf_coverless(input_pdf, pdf_out, page_num)
    print "Done."
def display_single_page():
    """Display a single page for planning purposes."""
    path = get_file_path()
    input_file = pdr(file(path, "rb"))
    print input_file.getPage(1).extractText().encode("utf-8")