From b75189fdbf82adcd8b2963880df5e77007e855b5 Mon Sep 17 00:00:00 2001 From: francesco Date: Tue, 20 Jan 2026 14:48:46 +0100 Subject: [PATCH] Update cemento.py --- cemento.py | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/cemento.py b/cemento.py index 5fc662d..3fa0bb0 100644 --- a/cemento.py +++ b/cemento.py @@ -56,30 +56,27 @@ def index(): def esegui_stampa_cups(f): try: ps_content = f"""%!PS -/Helvetica-Bold findfont 16 scalefont setfont -70 750 moveto (REPORT TECNICO CALCOLO CEMENTO) show -/Helvetica findfont 11 scalefont setfont -70 720 moveto (Volume: {f.get('res_vol')} m3 | Peso: {f.get('res_peso')} Kg) show -70 690 moveto (ACQUISTI:) show -80 675 moveto (- Cemento: {f.get('res_s_cem')} sacchetti) show -80 660 moveto (- Sabbia: {f.get('res_s_sab')} sacchetti) show -80 645 moveto (- Ghiaia: {f.get('res_s_ghi')} sacchetti) show -70 620 moveto (COSTO TOTALE: {f.get('res_costo_t')} Euro) show -70 590 moveto (DOSAGGIO CARICO ({f.get('res_nc')} carichi):) show -80 575 moveto (- Cemento: {f.get('res_bc_cem')} | Sabbia: {f.get('res_bc_sab')}) show -80 560 moveto (- Ghiaia: {f.get('res_bc_ghi')} | Acqua: {f.get('res_bc_aq')} L) show -70 500 moveto (Software Cemento Rev.1 | 20/01/2026) show +/Helvetica-Bold findfont 18 scalefont setfont +100 750 moveto (REPORT TECNICO CALCOLO CEMENTO) show +/Helvetica findfont 12 scalefont setfont +100 720 moveto (Volume: {f.get('res_vol')} m3 | Peso: {f.get('res_peso')} Kg) show +100 705 moveto (Costo: {f.get('res_costo_t')} Euro | Acqua: {f.get('res_aq')} L) show +100 680 moveto (ACQUISTI:) show +120 665 moveto (- Cemento: {f.get('res_s_cem')} | Sabbia: {f.get('res_s_sab')} | Ghiaia: {f.get('res_s_ghi')}) show +100 640 moveto (CARICO BETONIERA ({f.get('res_nc')} carichi):) show +120 625 moveto (- Cemento: {f.get('res_bc_cem')} | Sabbia: {f.get('res_bc_sab')} | Ghiaia: {f.get('res_bc_ghi')}) show +100 550 moveto (Software Cemento Rev.1 | 20/01/2026) show showpage""" comando = ["docker", "exec", "-i", "cups-pdf-server", "lp", "-d", "Virtual_PDF"] subprocess.run(comando, input=ps_content.encode('utf-8'), capture_output=True) - return "OK - PDF inviato a CUPS!" + return "OK - PDF generato correttamente!" except Exception as e: return f"Errore: {str(e)}" @app.route('/download', methods=['POST']) def download(): f = request.form - report = f"REPORT\nVolume: {f.get('res_vol')} m3\nCosto: {f.get('res_costo_t')} EUR" + report = f"REPORT TECNICO\nVolume: {f.get('res_vol')} m3\nCosto: {f.get('res_costo_t')} EUR" return Response(report, mimetype="text/plain", headers={"Content-disposition":"attachment;filename=Report.txt"}) if __name__ == '__main__':