Read PDF traffic fines automatically: text, OCR and limitations
Extract a vehicle registration number, date and amount from a PDF fine notice: text reading, OCR, field validation and what to do when the system is uncertain.

Read the fines in PDF automatically means extracting from a record the data that is needed — plate, date and time of the infringement, place, amount — without anyone reconstructing them by hand. It is one of the most concrete document extraction cases, and also one of the most instructive about what automation knows and cannot do.
The central lesson comes immediately: It's not an algorithm problem, it's a right field problem. Extracting "a date" from a record is trivial; understand that it serves that of infringement and not that of notification is essential to the process, and is not something you discover by reading documentation.
This article describes the assisted reading implemented for Rial Rent and its limits. The Rial Rent case study distinguishes implemented features from effects that have yet to be measured; the CRM for car rental presents its operational context.
In summary
- Two Roads in waterfall: first the text layer of the PDF, then the OCR if the document is a scan.
- OCR can confuse similar characters — for example, the letter O and zero — so format validation and comparison with the original are needed.
- The critical data is not the most difficult: it is the right date, that of the infringement and not that of notification.
- Running OCR in the browser concerns the reading stage; the first processing run can be slow, so progress must be shown.
- Warnings help, but filled-in fields must also be checked: a plausible format does not prove that the right data was selected.
How are the two types of fine PDFs read?
A PDF is not a format, they are two very different things that share an extension.
| Type of PDF | What it contains | How do you read | Reliability |
|---|---|---|---|
| Digital | A selectable text layer | You read the text directly | Extracted fields to verify |
| Scanning | Just an image of the page | Need OCR on image | Variable |
| Mixed | Text on some pages, images on others | First the text, then the OCR on the rest | Depends |
The correct sequence is to try always before the text. If it is present, image-based character recognition can be avoided. Errors in text order and field selection are still possible. In the implementation described, OCR is also used when the text does not provide key data, not only when text is absent.
What are the pros and cons of running OCR in the browser?
In the project the OCR turns on the device of who uploads the file, not on a server. The page is rendered on a canvas and passed to a recognition engine configured for Italian.
What You Earn
- OCR recognition runs on the device, without sending the document to a remote OCR service for this stage.
- No cost per page processed.
- No dependence on an external service that can change prices or close.
- The recognition stage is separate from storage, access and retention, which still need to be assessed.
What you pay for
- The first processing run is slow: the OCR language resources need to be loaded.
- The speed depends on the user's device.
- On very heavy documents the browser can struggle.
- You need to show the progress, or the user thinks it's blocked.
The last point seems aesthetic and is not. A wait of twenty seconds without any signal is read as a failure: the person reloads the page, tries again, and on the third time stops using the function. A progress bar with a line of text that explains what is going on completely changes the perception.
Why validate OCR data instead of trusting it?
OCR can confuse visually similar characters. These are recurring errors to consider, without assuming they are the only ones:
- The Letter O read as zero, and vice versa.
- The I capitalized confused with the number 1.
- The S confused with the 5, the B with the 8.
- Spaces inserted or lost in the middle of a sequence.
Knowing this, the strategy is simple: you look for the expected format rather than free-form content. An Italian registration number has a precise structure — two letters, three digits, two letters — and a regular expression can look for it while allowing known substitutions. In the extraction described, an O found in a numeric position can be normalised to zero. This corrects a possible confusion without proving that the suggested registration number is the one in the notice.
If after the expected corrections the result still does not respect the format, the system does not guess: it declares that it has not recognized the plate and asks for manual insertion.
Which date matters in a traffic fine notice?
This is the part that is not found in the technical documentation and that is only discovered by talking to those who do the work.
A record contains at least two dates: the date on which the infringement and the one in which the record was notified. They can be weeks away. For all technical uses — filing, searching, ordering — both are fine. For the use that really serves, that is, figuring out who was driving, only one works.
Taking the wrong one does not produce a visible error: it produces a plausible and wrong attribution, which comes to a customer who did not have the car that day. It's the kind of mistake that costs a business relationship.
The rules look for textual indicators associated with the date and time, but the suggested value may refer to the wrong field or include assumptions when the text is incomplete. A completed form or the absence of an error message is therefore not enough: the actual time of the offence must be confirmed against the notice. The next step — finding the driver — is described in Matching the fine to the driver.
Regular expressions or language model?
There is a basic choice worth making, because today the instinctive answer is "we use a model" and it is often wrong.
When regular expressions are enough
- The documents have recurring formats, although different from each other.
- The fields to be extracted have a known structure: plates, dates, amounts, codes.
- We need deterministic and repeatable behavior.
- You want to be able to explain exactly why the system extracted that value.
When you need a language model
- The documents are very heterogeneous and not traceable to patterns.
- The useful data is expressed in free language, not in a field.
- You need to interpret the sense, not locate a format.
- You can accept a share of errors and expect a human review.
For verbals the answer is the first column. An Italian plaque has a fixed structure, an amount has a recognizable format, a date as well. A language model would do the same job by introducing unpredictability where it is not needed, at a cost per document and without the ability to explain the output. The general comparison between the two approaches is in AI to analyze business documents.
This does not mean that AI has no place: on very variable supplier documents, or on texts in which the information is narrated instead of tabulated, the reasoning changes completely.
What happens to the data after it is extracted from fines?
Extraction is not the end, it is the beginning. The extracted fields must end somewhere and serve something.
- Precompilation of the card. Recognised fields fill in the form. A filled-in suggestion may be wrong or based on incomplete data: the person checks each relevant field and completes anything missing.
- Vehicle search. The validated plate is searched in the fleet: if it does not exist, the process stops with a clear message.
- Pairing with the driver. With plate and instant you look for the active contract, as described in Matching the fine to the driver.
- Archiving the document. The original PDF remains attached, because the extracted data never replaces the source.
The last point is a general rule of document automations: The original document is never thrown away. The extracted value is an operational convenience, the proof remains the file.
How does fine reading work in illustrative scenarios?
A digital fine notice. In this illustrative scenario, the PDF has a text layer: the system looks for the expected fields and suggests them in the form. A person still checks that the date, time, registration number and amounts match the notice. This is not a measured result from the Rial Rent sample.
A crooked photographed scan. The document was photographed instead of scanned. The OCR extracts the plate with the wrong character; the format validation corrects it because it falls within the known substitutions. The date on the other hand is illegible: the system declares it and asks to insert it.
A report from an entity with an unexpected format. The document’s structure does not match the expected formats. The rules may produce partial data or identify a value that is not the one needed. Comparison with the original and manual entry remain necessary.
Another type of document. The same scheme — text first, OCR then, validation always — applies to supplier invoices, bubbles and forms. The general theme is in document automation with AI and in AI to analyze business documents.
What mistakes should you avoid when reading fines automatically?
Sending everything to the OCR. It costs time and introduces errors on documents that would be perfectly read from the text.
Not validating the extracted fields. A data extract without format control is a data you know nothing about. Validation is what makes the output of an OCR usable.
Filling the fields with the best guess. It is the choice that makes automation unusable: no one controls a field that is compiled, so the error passes.
Not showing progress. A silent wait is interpreted as a failure, and the function stops being used.
Extract the wrong data with great precision. It is the most insidious error because technically the system works: it reads a date that is not needed very well. Correction is not technical, it is understanding the process.
How do you introduce automatic fine reading in a company?
- Look at twenty real documents before writing anything. How many are digital and how many scans? From this proportion depends how central the OCR will be.
- Ask who does the work which data really serves, not what data there are. They are different questions and the second door off the road.
- Define the expected format of each field: is the basis of validation and is worth more than any model.
- Decide what happens when the system is unsafe, and turn it into a screen, not an unhandled case.
- Evaluate where you process: in the browser for confidentiality, on servers for speed and uniformity. On data processing it is worth reading AI and Data Security.
If the documents to be processed are many and come from different channels, the theme widens to the data entry automation.
Conclusion
Read the fines in PDF automatically makes it possible to suggest data for recording. OCR and rules can make mistakes: format validation helps, but does not replace comparison with the fine notice or demonstrate extraction accuracy.
The rule that's worth the most: make the system say when it's not safe. Honest automation about one's limits is used; one that guesses is abandoned after the first mistake discovered by chance.
Do you want to understand what processes in your company can be automated with AI? Giallo Studio can help you turn the problem into a real workflow. The complete project is in custom software.
Giallo Studio guides: methodology and sources
Want to apply this to your business?In 30 minutes, free of charge: the first process to automate and its estimated return, in writing.
Book the free auditHow we apply it in the company
Related resources
FAQ
Can you read the data of a fine from a PDF automatically?
Yes, using two different approaches depending on the document. If the PDF is digital and has a text layer, the text can be read directly, but the identified fields must be checked. If it is a scan, OCR is needed to recognise characters in the image and is less accurate: extracted fields must always be validated.
How reliable is OCR on a penalty notice?
It depends on scan quality. It works well on a straight, clear document; on a skewed or low-resolution scan, it confuses similar characters, such as the letter O and zero. This is why the system must validate the format of what it extracts rather than simply trusting it.
Is it better to process documents in the browser or on a server?
Browser-based OCR performs recognition on the device. This concerns the reading stage: it does not rule out subsequent file storage or handling within the service infrastructure. The trade-off is that the first processing run is slow because the language model needs to be downloaded: progress must be shown to the user, otherwise it looks stuck.
What is the most difficult data to extract from a penalty notice?
Not the most technically difficult, but the easiest to get wrong: the date. A penalty notice contains the date of the offence and the notification date, which are different things. Using the wrong one means attributing responsibility to the wrong person.
What does the system have to do when it can't read?
State this and ask for manual entry. Automation that stops when uncertain is more useful than automation that fills fields with its best guess: manual completion requires an explicit check, while plausible but incorrect data can go unnoticed. Filled-in fields must also be verified.
Do you need artificial intelligence to do this?
Not necessarily. In this project, text reading and extraction rules are the intended path for digital PDFs, and OCR is used when the text does not provide key data, even if the PDF contains a text layer. A language model can help with highly variable documents, but introduces unpredictability where determinism would be needed.




