From 871067abe2bd0dc1d8229861139e4100de58f3f3 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Sat, 20 Feb 2016 18:01:25 +0100 Subject: merge.py begonnen --- Kasimirs_Liederbuch/merge.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Kasimirs_Liederbuch/merge.py diff --git a/Kasimirs_Liederbuch/merge.py b/Kasimirs_Liederbuch/merge.py new file mode 100644 index 0000000..7fb484c --- /dev/null +++ b/Kasimirs_Liederbuch/merge.py @@ -0,0 +1,14 @@ +from pyPdf import PdfFileWriter, PdfFileReader +output = PdfFileWriter() + +ipdf = PdfFileReader(open('Alle_meine_Entchen.pdf', 'rb')) +wpdf = PdfFileReader(open('pin.pdf', 'rb')) +watermark = wpdf.getPage(0) + +for i in xrange(ipdf.getNumPages()): + page = ipdf.getPage(i) + page.mergePage(watermark) + output.addPage(page) + +with open('newfile.pdf', 'wb') as f: + output.write(f) -- cgit v1.2.3-70-g09d2