diff options
-rw-r--r-- | Kasimirs_Liederbuch/merge.py | 14 |
1 files changed, 14 insertions, 0 deletions
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) |