tricks to compile 2 pdf from 1 source file

This commit is contained in:
2020-02-01 19:04:02 -06:00
parent 18422f8d65
commit a9baf1b501
4 changed files with 93 additions and 49 deletions

View File

@@ -1,14 +1,15 @@
#!/usr/bin/env python3
import qrcode
qr = qrcode.QRCode(
version=2,
error_correction=qrcode.constants.ERROR_CORRECT_Q,
box_size=5,
border=1)
with open("qrEvent_vi.txt") as fp:
qr.add_data(fp.read())
qr.make(fit=True)
img = qr.make_image(fill_color="orangered", back_color="white")
img.save("qr.png")
for fname in ["qrEvent_en", "qrEvent_vi"]:
qr = qrcode.QRCode(
version=2,
error_correction=qrcode.constants.ERROR_CORRECT_Q,
box_size=5,
border=1)
with open(f"{fname}.txt") as fp:
qr.add_data(fp.read())
qr.make(fit=True)
img = qr.make_image(fill_color="orangered", back_color="white")
img.save(f"{fname}.png")