| 18949 | return title.text if title else "" |
| 18950 | |
| 18951 | class ReportGenerator: |
| 18952 | def _tab_warnings(self): |
| 18953 | return [ |
| 18954 | "OSINT e Face Recognition forniscono indicatori investigativi, non prove assolute di identita.", |
| 18955 | "Qualita immagine/video, illuminazione, angolo e alterazioni AI possono influenzare i risultati.", |
| 18956 | "I dati social/telefono/web possono essere incompleti, obsoleti o non verificati alla fonte.", |
| 18957 | "Ogni esito ad alta similarita richiede validazione indipendente e revisione umana professionale.", |
| 18958 | "Uso consentito solo in conformita alle leggi vigenti su privacy, consenso e trattamento dati." |
| 18959 | ] |
| 18960 | |
| 18961 | def _latin1(self, v): |
| 18962 | return str(v).encode("latin-1", "ignore").decode("latin-1") |
| 18963 | |
| 18964 | def _mc(self, pdf, h, text): |
| 18965 | pdf.set_x(pdf.l_margin) |
| 18966 | pdf.multi_cell(0, h, self._latin1(text)) |
| 18967 | |
| 18968 | def _pdf_cover(self, pdf, title, subtitle="CScorza Report"): |
| 18969 | pdf.add_page() |
| 18970 | pdf.set_auto_page_break(auto=True, margin=12) |
| 18971 | logo_path = Path(__file__).resolve().parent / "Logo.gif" |
| 18972 | if not logo_path.exists(): |
| 18973 | logo_path = Path(__file__).resolve().parent / "logo.gif" |
| 18974 | if logo_path.exists(): |
| 18975 | try: |
| 18976 | pdf.image(str(logo_path), x=(pdf.w - 44) / 2, y=30, w=44) |
| 18977 | except Exception: |
| 18978 | pass |
| 18979 | pdf.set_y(86) |
| 18980 | pdf.set_font("Helvetica", "B", 18) |
| 18981 | pdf.cell(0, 10, self._latin1("CScorza Report"), align="C", new_x=XPos.LMARGIN, new_y=YPos.NEXT) |
| 18982 | pdf.set_font("Helvetica", "", 12) |
| 18983 | pdf.cell(0, 8, self._latin1(f"Versione tool: v{APP_VERSION}"), align="C", new_x=XPos.LMARGIN, new_y=YPos.NEXT) |
| 18984 | pdf.cell(0, 8, self._latin1(datetime.now(timezone.utc).strftime("%Y-%m-%d %H:%M:%S UTC")), align="C", new_x=XPos.LMARGIN, new_y=YPos.NEXT) |
| 18985 | pdf.ln(6) |
| 18986 | pdf.set_font("Helvetica", "", 10) |
| 18987 | pdf.cell(0, 6, self._latin1(subtitle), align="C", new_x=XPos.LMARGIN, new_y=YPos.NEXT) |
| 18988 | |
| 18989 | def _pdf_notes_page(self, pdf, notes_title, notes): |
| 18990 | pdf.add_page() |
| 18991 | pdf.set_font("Helvetica", "B", 14) |
| 18992 | pdf.cell(0, 9, self._latin1(notes_title), new_x=XPos.LMARGIN, new_y=YPos.NEXT) |
| 18993 | pdf.set_font("Helvetica", "", 10) |
| 18994 | if isinstance(notes, (list, tuple)): |
| 18995 | for n in notes: |
| 18996 | self._mc(pdf, 6, f"- {n}") |
| 18997 | else: |
| 18998 | self._mc(pdf, 6, str(notes or "N/D")) |
| 18999 | pdf.ln(3) |
| 19000 | pdf.set_font("Helvetica", "B", 11) |
| 19001 | pdf.cell(0, 8, self._latin1("Avvertenze Tab"), new_x=XPos.LMARGIN, new_y=YPos.NEXT) |
| 19002 | pdf.set_font("Helvetica", "", 10) |
| 19003 | for w in self._tab_warnings(): |
| 19004 | self._mc(pdf, 6, f"- {w}") |
| 19005 | |
| 19006 | def _pdf_table(self, pdf, title, rows): |
| 19007 | pdf.ln(2) |
| 19008 | pdf.set_font("Helvetica", "B", 11) |
no outgoing calls
no test coverage detected