Changeset 16159 for main/waeup.kofa/trunk/src/waeup/kofa/students
- Timestamp:
- 10 Jul 2020, 06:11:44 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py
r16158 r16159 20 20 import grok 21 21 import textwrap 22 from copy import deepcopy 22 23 from cgi import escape 23 24 from time import time … … 941 942 merger = PdfFileMerger() 942 943 merger.append(StringIO(pdf_stream)) 943 if watermark:944 watermark = PdfFileReader(watermark)945 944 for file in mergefiles: 946 945 if watermark: 947 946 # Pass through all pages of each file 948 # and merge with watermark page. 947 # and merge with watermark page. Paint 948 # watermark first to make it transparent. 949 949 marked_file = PdfFileWriter() 950 950 orig_file = PdfFileReader(file) 951 951 num_pages = orig_file.getNumPages() 952 952 for num in range(num_pages): 953 page = orig_file.getPage(num) 954 page.mergePage(watermark.getPage(0)) 953 watermark_file = PdfFileReader(watermark) 954 page = watermark_file.getPage(0) 955 page.mergePage(orig_file.getPage(num)) 955 956 marked_file.addPage(page) 956 957 # Save into a file-like object … … 961 962 else: 962 963 # Just append the file object 963 merger.append(file [1])964 merger.append(file) 964 965 # Save into a file-like object 965 966 tmp2 = StringIO()
Note: See TracChangeset for help on using the changeset viewer.