-
Notifications
You must be signed in to change notification settings - Fork 131
Description
📝 Description
When the AI writes a very long name or a long sentence, it doesn't fit in the small boxes on the PDF. Currently, the extra words just get cut off at the edge of the box. This feature will make the font "shrink" automatically so the whole sentence stays inside the box.
💡 Rationale
In emergency reporting, names, addresses, or even other fields can be very long and incident descriptions can be detailed. If the text is cut off, the legal document is incomplete. We need the PDF to be smart enough to resize the text so every word is readable.
🛠️ Proposed Solution
We will use a "Magic Zero" trick in the PDF code. If we tell the PDF that the font size is 0, the PDF reader (like Chrome or Adobe) will automatically shrink the text until it fits the box perfectly.
-
Logic change in src/filler.py: Add a check to see if the text is long (>20 characters).
-
Update annot.DA: Change the font setting to /Helv 0 Tf. This triggers the "Auto-Size" mode.
-
Clear Appearance (annot.AP): Tell the PDF to redraw the text so the new size shows up immediately.
✅ Acceptance Criteria
-
Long Text Test: If we input a 50-character name, it should appear small but fully visible inside the box.
-
Short Text Test: Short words like "Fire" should stay at the normal, large font size.
📌 Additional Context
This is a standard feature in professional PDF software. Instead of us doing hard math to guess the font size, we are letting the PDF format do the work for us.