Example #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
Example #2
0
def write_pdf_coverless(input_pdf, pdf_out, page_num):
    """
    Writes contents of pdf file to a *.pdf file,
    without a cover page.
    """
    pdfw = pdw()
    with open(pdf_out, "wb") as w_file:
        for page in range(1, page_num):
            pdfw.addPage(input_pdf.getPage(page))
        pdfw.write(w_file)