Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- """
- Created on Thu Nov 20 11:51:48 2018
- @author: wagner
- """
- #Imports:
- from PyPDF2 import PdfFileMerger, PdfFileReader, PdfFileWriter
- def pdf_add_page():
- output = PdfFileWriter()
- for FileName in FileList:
- filename1 = '%s/%s.pdf' %(path, FileName)
- file1 = PdfFileReader(file(filename1, "rb"))
- output.addPage(file1.getPage())
- filename2 = '%s/%s.pdf' %(path, 'file_pdf_full')
- outputStream = file(filename2, "wb")
- output.write(outputStream)
- outputStream.close()
- path = '/home/wagner/SSI/BancoInter/'
- FileList = ['file_pdf_pag1-3', 'file_pdf_pag3-5']
- merger = PdfFileMerger()
- for FileName in FileList:
- filename1 = '%s/%s.pdf' %(path, FileName)
- merger.append(PdfFileReader(file(filename1, 'rb')))
- filename2 = '%s/%s.pdf' %(path, 'file_pdf_full')
- merger.write(filename2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement