Guide
OCR pitfalls in part numbers: look-alike characters and a check routine
OCR can swap look-alike characters in a part number, such as 0 and O, 1, I and l, or 5 and S, and can drop a trailing suffix. A misread code still looks plausible, so the quantity check cannot catch it. Check each MPN against its description, its length and a catalogue lookup before the BOM is used.
Routine
A verification routine
Find out how the PDF was read
A PDF with a text layer holds its characters directly. A scan or an image-only PDF was read by OCR, and every character is a candidate for error.
Scan for look-alikes
Look for a letter between two digits, or a digit in the middle of a run of letters. 1N4148 is normal; STM32F1O3C8T6 is not.
Compare the MPN with the description
Many resistor and capacitor codes embed the value. A code written like CRCW04024K70FKED embeds 4K70, which reads as 4.7 kΩ. If the description says 47 kΩ, one of them is wrong.
Compare length and ending
Codes in one family often end in packaging or grade suffixes. A line that stops short of its siblings may have lost one.
Look the code up
Search the full code in a catalogue. A miss, or a different part, sends you back to the source.
Fix it at the source
Correct the design data or the original document, not only the converted copy, so the next export is right.
Causes
Where OCR goes wrong
OCR reads shapes, and in many fonts 0 and O, 1 and I and l, or 5 and S are close. Part numbers are the worst case. They are not words, so there is no dictionary to prefer the sensible reading, and one wrong character makes a different, often unorderable, code. Small print, low-resolution scans and condensed fonts make it worse, and a suffix can be cut off at a cell edge.
Where you can, avoid the problem: export the BOM from the design tool as CSV or as a text-layer PDF instead of printing it to a scan. If you must scan, 300 dpi is a common minimum.
Example
Two misreads that pass the count
STM32F1O3C8T6 has a letter O between two digits. The code on the BOM template page is STM32F103C8T6. In the other case, LM1117IMPX-3.3/NOPB read as LM1117IMPX-3.3 has lost its packaging suffix, and may match a different orderable variant or nothing. Neither error changes a quantity or a designator count, so the arithmetic checks pass. The designator count check proves the count, not the characters.
Reference
Look-alike pairs and where they hide
| Pair | Often confused | Where it hides | How to catch it |
|---|---|---|---|
| 0 and O | Zero and capital O | Inside digit runs, as in 1O3 for 103 | A letter between two digits |
| 1, I and l | One, capital I, lowercase l | Series codes and value codes | Compare with sibling lines |
| 5 and S | Five and capital S | Prefixes and value codes | A letter between digits, or a digit among letters |
| 8 and B | Eight and capital B | Grade and tolerance letters | Compare with the description |
| rn and m | r followed by n | Mid-code letters in a family name | Catalogue lookup |
| Lost suffix | Packaging or grade letters cut off | The end of the code, at a cell edge | Length check and catalogue lookup |
Pitfalls
What goes wrong
- Auto-correcting. A tool that rewrites a suspect character swaps one guess for another, and the BOM looks cleaner than it is.
- Trusting a catalogue hit. A lookup can succeed on the wrong variant. Check the package and rating against the description.
- Checking only flagged codes. Flags cover patterns. An 8 for a B, or a lost suffix, passes unflagged.
- Suffix drift. The base code orders, but the packaging or grade differs. See MPN vs internal part number.
- Copying OCR output into the master. The error then travels into every later BOM and order.
- Treating a text-layer PDF as a scan. A flagged code in a text-layer PDF may be genuine. Confirm before changing it.
The tool
How BOMParser helps
BOMParser reads PDFs with a text layer directly and scanned PDFs by OCR. On every MPN it lists a letter sitting between digits, or a digit in the middle of a run of letters, together with the alternatives. These show as a warning when the PDF was read by OCR and as a note when it had a text layer. It never changes a character. It does not detect 8 and B swaps or dropped suffixes, so the routine above still applies. Convert a file on the BOM to CSV page; pricing lists the plans. Free: 1 file per day, up to 10 pages, no account. Files over 10 pages are converted up to page 10 on the free allowance; a page code converts the whole file, up to 150 pages.
FAQ
OCR and part number questions
Why does OCR confuse 0 and O?
In many fonts the two shapes differ only slightly, and a part number gives OCR no word to prefer, so it picks the closer shape. The same goes for 1, I and l, and for 5 and S.
Does a PDF with a text layer have OCR errors?
No. A PDF with a text layer holds its characters directly, so OCR is not involved. Typing errors at the source are still possible.
How can I tell whether a PDF was scanned?
Try to select and search the text in a PDF viewer. If you cannot highlight single words, or a search finds nothing, the page is probably an image and has to be read by OCR.
Can a designator count catch a misread part number?
No. The count compares quantities with designators, and a misread character changes neither. Part numbers need their own checks.
What is the quickest check for a part number?
Search the full code in the manufacturer's or a distributor's catalogue, then compare the package, value and rating with the BOM description. A miss or a mismatch needs a closer look.
Should software correct suspect characters automatically?
Not silently. A correction is a guess, and a guessed code can still look valid. List the suspects, confirm them against a source, and change the source data.
What resolution should I scan a BOM at?
300 dpi is a common minimum for printed text, and higher helps with small print. Keep the page straight and avoid shrink-to-fit printing.
Keep reading
Related guides
MPN vs internal part number
Why a BOM needs both, and how to keep a mapping table.
KiCad and Altium BOM export columns
Typical export fields, and how they map to a clean BOM.
BOM revision control
Rev letters, change logs and matching Gerbers.