misc
python : - switched logging from DEBUG to INFO - changed dummy font to remove warning - removed arg to pdf.output() to cleanup warning html: - changed labels to be clearer
This commit is contained in:
@@ -15,7 +15,7 @@ def generateTemplate(width: int, height: int, fondPerdu: int, zoneTranquille: in
|
||||
|
||||
pdf = fpdf.FPDF("P", "mm", (width + margeDuContenue *
|
||||
2, height + margeDuContenue * 2))
|
||||
pdf.set_font("Arial", "B", 16) # dummy font
|
||||
pdf.set_font("helvetica", "B", 16) # dummy font
|
||||
pdf.set_margins(0, 0)
|
||||
pdf.set_auto_page_break(False)
|
||||
pdf.add_page()
|
||||
@@ -125,10 +125,10 @@ def generate():
|
||||
|
||||
except (KeyError, ValueError) as e:
|
||||
flask.abort(400)
|
||||
app.logger.debug(
|
||||
app.logger.info(
|
||||
"w %d ; h %d ; fp %d ; zt %d ; m %d ; ffp %s", w, h, fp, zt, m, ffp)
|
||||
if k != "zip":
|
||||
pdf = generateTemplate(w, h, fp, zt, m, k, image,ffp).output(dest="S")
|
||||
pdf = generateTemplate(w, h, fp, zt, m, k, image, ffp).output()
|
||||
return flask.send_file(
|
||||
io.BytesIO(pdf),
|
||||
mimetype="application/pdf",
|
||||
@@ -139,7 +139,7 @@ def generate():
|
||||
zipHandle = zipfile.ZipFile(
|
||||
zipBuffer, "a", zipfile.ZIP_DEFLATED, False, 9)
|
||||
for kk in [x for x in VALID_KIND if x != "zip"]:
|
||||
pdf = generateTemplate(w, h, fp, zt, m, kk, image,ffp).output(dest="S")
|
||||
pdf = generateTemplate(w, h, fp, zt, m, kk, image, ffp).output()
|
||||
zipHandle.writestr(f'{w}x{h}_{kk}.pdf', pdf)
|
||||
zipHandle.close()
|
||||
return flask.send_file(
|
||||
@@ -151,3 +151,4 @@ def generate():
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(host='0.0.0.0', port=8000)
|
||||
|
||||
|
@@ -86,8 +86,8 @@
|
||||
<label for="rb_tc">Traits de coupe</label><input required type="radio" value="tc" name="kind" id="rb_tc">
|
||||
<label for="rb_zc">Zone de construction</label><input required type="radio" value="zc" name="kind"
|
||||
id="rb_zc">
|
||||
<label for="rb_all">Tout</label><input required type="radio" value="all" name="kind" id="rb_all">
|
||||
<label for="rb_zip">ZIP</label><input required type="radio" value="zip" name="kind" id="rb_zip" checked>
|
||||
<label for="rb_all">Zone de construction & traits de coupe</label><input required type="radio" value="all" name="kind" id="rb_all">
|
||||
<label for="rb_zip">ZIP (3 PDF en 1 clique)</label><input required type="radio" value="zip" name="kind" id="rb_zip" checked>
|
||||
</div>
|
||||
<div class="two-col">
|
||||
<span>
|
||||
|
Reference in New Issue
Block a user