|
33 | 33 | import subprocess
|
34 | 34 | import qrencode
|
35 | 35 | from tempfile import mkstemp
|
| 36 | +from datetime import datetime |
36 | 37 | from PIL import Image
|
37 | 38 | from pyx import *
|
38 | 39 |
|
@@ -135,14 +136,16 @@ def finish_page(pdf, canv, pageno):
|
135 | 136 | # will use pdf as the tmpfile has a .pdf suffix
|
136 | 137 | pdf.writetofile(temp_barcode_path)
|
137 | 138 |
|
| 139 | +# prepare plain text output |
138 | 140 | fd, temp_text_path = mkstemp('.ps', 'text_', '.')
|
| 141 | +input_file_modification = datetime.fromtimestamp(os.path.getmtime(input_path)).strftime("%Y-%m-%d %H:%M:%S") |
139 | 142 |
|
140 | 143 | # use "enscript" to create postscript with the plaintext
|
141 | 144 | p = subprocess.Popen(
|
142 | 145 | ["enscript", "-p"+temp_text_path, "-f", "Courier12",
|
143 |
| - "-M" + paperformat_str, "--header", |
144 |
| - just_filename + "|Page $%"], |
145 |
| - stdout=subprocess.PIPE,stdin=subprocess.PIPE) |
| 146 | + "-M" + paperformat_str, "--header", |
| 147 | + just_filename + "|" + input_file_modification + "|Page $%"], |
| 148 | + stdout=subprocess.PIPE, stdin=subprocess.PIPE) |
146 | 149 |
|
147 | 150 | # send the file and a tag line to enscript
|
148 | 151 | p.stdin.write(ascdata.encode('utf-8'))
|
|
0 commit comments