summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2016-02-20 18:01:25 +0100
committerErich Eckner <git@eckner.net>2016-02-24 14:24:51 +0100
commit871067abe2bd0dc1d8229861139e4100de58f3f3 (patch)
tree42d8adb872b9b0e52fe56db052b75c76cb388f89
parent0e5f9fbbc7a4337f4fbc207bf775370046800893 (diff)
downloadMusik-871067abe2bd0dc1d8229861139e4100de58f3f3.tar.xz
merge.py begonnenpdf-merge-script
-rw-r--r--Kasimirs_Liederbuch/merge.py14
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)