env = env # noqa import subprocess, os rep = env.ref('fusion_plating_reports.action_report_fp_bol_landscape') dlv = env['fusion.plating.delivery'].search([], order='id desc', limit=1) pdf, _ = rep.with_context(force_report_rendering=True )._render_qweb_pdf(rep.report_name, [dlv.id]) path = '/tmp/bol_landscape.pdf' with open(path, 'wb') as f: f.write(pdf) print(f'wrote {len(pdf)/1024:.1f} KB to {path}') # Extract text per page using pdftotext (poppler-utils) try: for p in (1, 2, 3): out = subprocess.run( ['pdftotext', '-layout', '-f', str(p), '-l', str(p), path, '-'], capture_output=True, text=True, timeout=10 ) if out.returncode != 0 or not out.stdout.strip(): continue text = out.stdout sig_labels = [ 'Shipper (Signature' in text, 'Carrier / Driver' in text, 'Consignee (Signature' in text, ] cert_present = 'is to certify' in text print(f'PAGE {p}: cert={cert_present} sigs={sig_labels} ' f'(all-3-sigs-together={all(sig_labels)})') except FileNotFoundError: print('pdftotext not installed — skipping per-page text check')