<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: ocr2excel team</title>
    <description>The latest articles on DEV Community by ocr2excel team (@ocr2excel).</description>
    <link>https://dev.to/ocr2excel</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4199874%2F20edbb16-c312-4952-bf75-be3c03f3be31.png</url>
      <title>DEV Community: ocr2excel team</title>
      <link>https://dev.to/ocr2excel</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ocr2excel"/>
    <language>en</language>
    <item>
      <title>When 9.75 becomes 975: what silently breaks in browser-side invoice OCR</title>
      <dc:creator>ocr2excel team</dc:creator>
      <pubDate>Fri, 23 Oct 2026 07:50:46 +0000</pubDate>
      <link>https://dev.to/ocr2excel/when-975-becomes-975-what-silently-breaks-in-browser-side-invoice-ocr-5466</link>
      <guid>https://dev.to/ocr2excel/when-975-becomes-975-what-silently-breaks-in-browser-side-invoice-ocr-5466</guid>
      <description>&lt;p&gt;We ran a real invoice through our own converter and opened the export in Excel.&lt;/p&gt;

&lt;p&gt;The date on the page read &lt;code&gt;11/02/2019&lt;/code&gt;. The cell said &lt;code&gt;1110212019&lt;/code&gt;. The total was &lt;code&gt;9.75&lt;/code&gt;. The cell said &lt;code&gt;975&lt;/code&gt;. And &lt;code&gt;Invoice Total $204.75&lt;/code&gt;, the one line a bookkeeper actually needs, was not in the file at all. That row did not exist.&lt;/p&gt;

&lt;p&gt;Nothing errored. No red toast, no console warning. The file opened cleanly in Excel, the columns were aligned, and every number looked like a number. Which is the worst possible failure mode for a financial document: the output looked exactly as confident as correct output does.&lt;/p&gt;

&lt;p&gt;This was not a regression. It was the capability boundary of a pipeline we had built ourselves, and finding out where that boundary sits took an A/B harness, a real browser, and a list of failures we did not expect.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why run OCR in the browser at all
&lt;/h2&gt;

&lt;p&gt;The popular reason given is privacy, and it is true, but it is not the engineering reason.&lt;/p&gt;

&lt;p&gt;The engineering reason is that a converter which never receives the file has no retention problem to solve. There is no bucket to expire, no support ticket that starts with "please delete my upload", no third-party processor to add to a privacy policy. When a bookkeeper photographs a bank statement and hands it to a page, the server side of that transaction is a static file host. It does not know the file existed.&lt;/p&gt;

&lt;p&gt;The cost is that you inherit every problem a server would have solved for you: model delivery, memory limits on a phone, and the fact that the OCR engine which runs in a browser is not the same engine you tested in Node.&lt;/p&gt;

&lt;p&gt;We wrote about that cost, and about why Tesseract hands you a bag of words instead of a table, in &lt;a href="https://dev.to/ocr2excel/table-ocr-in-the-browser-what-tesseract-gives-you-and-what-it-doesnt-3b1e"&gt;an earlier post&lt;/a&gt;. This one is about what happens when that pipeline meets a real invoice.&lt;/p&gt;

&lt;p&gt;That last one is where the date turned into &lt;code&gt;1110212019&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Six failures, none of which raised an error
&lt;/h2&gt;

&lt;p&gt;We rebuilt the invoice sample as a repeatable fixture: one image, one browser, two builds side by side on localhost. Old build on port 8800, new on 8799, same Edge, same machine. Everything below is from that comparison, not from memory.&lt;/p&gt;

&lt;p&gt;The slash read as a one. &lt;code&gt;11/02/2019&lt;/code&gt; came out as &lt;code&gt;1110212019&lt;/code&gt;. At the source resolution, a &lt;code&gt;/&lt;/code&gt; in a 9pt font is one to two pixels wide. There is no character there for the model to classify. It reads the stroke as &lt;code&gt;1&lt;/code&gt; and moves on.&lt;/p&gt;

&lt;p&gt;The decimal point disappeared. &lt;code&gt;9.75&lt;/code&gt; exported as &lt;code&gt;975&lt;/code&gt;. Same cause, different victim. A tenfold error in a tax line, with no marker that anything went wrong.&lt;/p&gt;

&lt;p&gt;The largest text on the page vanished. &lt;code&gt;Invoice Total $204.75&lt;/code&gt;, the single most important line on an invoice, was dropped entirely. This one only reproduced in the browser. Our Node probe found the line; the browser build, using the SIMD LSTM core, discarded the oversized text block during page segmentation.&lt;/p&gt;

&lt;p&gt;That discrepancy is worth pausing on. If we had validated in Node, we would have shipped believing the total was safe.&lt;/p&gt;

&lt;p&gt;A decorative bar became a word. A solid blue header bar was returned as the word &lt;code&gt;ree&lt;/code&gt; at 66% confidence, bounding box 1282×55. Sixty-six percent is above plenty of thresholds, so confidence filtering alone let it through into the export.&lt;/p&gt;

&lt;p&gt;One invoice became six sheets. The page was split by horizontal gaps 2.5× the word height, so every visual block (the header, the address, the line items, the total band) became its own tab.&lt;/p&gt;

&lt;p&gt;A misread digit was written as a number. This is the one that actually frightens us. Export logic converted any digit-shaped string into a numeric cell. So &lt;code&gt;975&lt;/code&gt;, a misread &lt;code&gt;9.75&lt;/code&gt;, became a real number in a real column, ready to be summed.&lt;/p&gt;

&lt;h2&gt;
  
  
  What actually fixed it
&lt;/h2&gt;

&lt;p&gt;We tried four levers separately, so we could see which one was carrying the weight.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Variant&lt;/th&gt;
&lt;th&gt;Words&lt;/th&gt;
&lt;th&gt;Key fields correct (of 6)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Baseline (original image, single pass)&lt;/td&gt;
&lt;td&gt;94&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Upscaled 2×&lt;/td&gt;
&lt;td&gt;96&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Upscaled + auto-levels&lt;/td&gt;
&lt;td&gt;96&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Upscaled + auto-levels + sparse second pass&lt;/td&gt;
&lt;td&gt;97&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Upscaling was the main lever. Long edge below 1600px gets an integer upscale capped at 3×. That alone recovered &lt;code&gt;Horne&lt;/code&gt;, &lt;code&gt;BILL TO&lt;/code&gt;, &lt;code&gt;9.75&lt;/code&gt;, &lt;code&gt;26/02/2019&lt;/code&gt; and &lt;code&gt;50.00&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The contrast pass did nothing on this image, and we kept it anyway. The levels-stretch output was byte-identical to the upscaled version, because the invoice already had enough contrast. It fires only when the p1–p99 luma range is narrower than 180, which means washed-out scans and phone photos in poor light. The conditional design is what let us add it without risking the images that already worked.&lt;/p&gt;

&lt;p&gt;The second recognition pass mattered only in the browser. A sparse-text pass (psm 11) alongside the default page segmentation is what recovered the total line, in the browser build. In Node it added one word, because Node's build had already found the line. Same code, different result, decided entirely by which WASM core was loaded.&lt;/p&gt;

&lt;h2&gt;
  
  
  Do not trust confidence alone
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;ree&lt;/code&gt; case is the one we keep coming back to.&lt;/p&gt;

&lt;p&gt;Confidence 66 is not low enough to reject by threshold; plenty of legitimately hard text sits there. But the bounding box was 1282 pixels wide and 55 tall, for three characters. No font renders at a width-per-character ratio of 7.77.&lt;/p&gt;

&lt;p&gt;So the filter that kills it is geometric, not statistical:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// width-per-character over height must stay text-like&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;WORD_FILTER&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;freeze&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;maxCharAspect&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;2.5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Confidence tells you how sure the model is. Geometry tells you whether the thing could be a word at all. For decorative elements, only the second question has a reliable answer.&lt;/p&gt;

&lt;h2&gt;
  
  
  The rule we adopted for numbers
&lt;/h2&gt;

&lt;p&gt;Every numeric cell now has to clear a confidence threshold before it is allowed to be a number. Below 75, it stays text.&lt;/p&gt;

&lt;p&gt;This is deliberately annoying. A text cell shouts at the user: Excel flags it, &lt;code&gt;SUM()&lt;/code&gt; skips it, the bookkeeper notices. A wrong number sits in the column looking correct and quietly poisons the total.&lt;/p&gt;

&lt;p&gt;For a document whose entire purpose is arithmetic, a value that cannot be trusted should not be allowed to pretend it is a number. We would rather hand over an obviously broken cell than a plausible wrong one.&lt;/p&gt;

&lt;p&gt;There is a matching rule on the other side: when the user manually edits a cell in the preview, we treat that as confirmation and re-evaluate it under the same logic. Otherwise a person who fixes a digit would still get text, because the original OCR confidence never changed.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this pipeline still cannot do
&lt;/h2&gt;

&lt;p&gt;Here is where the boundary actually sits.&lt;/p&gt;

&lt;p&gt;It is geometric reconstruction, not semantic extraction. The engine knows that two words sit on the same horizontal band; it does not know that &lt;code&gt;INVOICE DATE&lt;/code&gt; is a key and the value beside it is its value. Key-value pairs do not get aligned. Address lines and metadata lines interleave by y-coordinate.&lt;/p&gt;

&lt;p&gt;Number formats are not preserved. &lt;code&gt;100.00&lt;/code&gt; comes out as &lt;code&gt;100&lt;/code&gt;. For invoices, the cents column carries meaning, and we lose it at the export layer. The export-format side of this (xlsx versus csv versus txt) is in the &lt;a href="https://dev.to/ocr2excel/table-ocr-in-the-browser-what-tesseract-gives-you-and-what-it-doesnt-3b1e"&gt;earlier post&lt;/a&gt;; here it stays a limitation we have not solved.&lt;/p&gt;

&lt;p&gt;Handwriting is not in scope. A signature comes back as something like &lt;code&gt;Sut&lt;/code&gt;, flagged as a low-confidence cell. We keep it rather than silently deleting it, because a flagged cell is information and a deleted one is not.&lt;/p&gt;

&lt;p&gt;Multi-page and field-level accuracy are not solved here. If a workflow needs the invoice number, the tax amount, and the vendor name to be correct every time across arbitrary layouts, on-device OCR is the wrong tool. That needs a server-side vision model, and it needs the file to leave the device, which is a product decision rather than a technical one. We have not made it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The tradeoff we accepted
&lt;/h2&gt;

&lt;p&gt;The borderless document path went from about one second to about three, because it now runs a second recognition pass. Documents with ruled tables are unchanged at one second: if the de-lining step finds a real grid, the sparse pass is skipped, since a ruled table reads cleanly without it.&lt;/p&gt;

&lt;p&gt;Three seconds and a correct total, versus one second and &lt;code&gt;975&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The tool is at &lt;a href="https://ocr2excel.com/?utm_source=devto&amp;amp;utm_medium=referral" rel="noopener noreferrer"&gt;ocr2excel.com&lt;/a&gt; if you want to test it against an invoice of your own. Recognition runs locally with WebAssembly, there is no signup, and the batch limits are 10 files, 50 MB total, 10 pages per PDF.&lt;/p&gt;

&lt;p&gt;If you are building something similar, the two things we would pass on: validate in the browser rather than in Node, because the WASM core you ship is not the engine you benchmarked. And make the numeric path fail loudly, because in financial documents the silent errors are the expensive ones.&lt;/p&gt;

</description>
      <category>ocr</category>
      <category>webassembly</category>
      <category>showdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Table OCR in the browser: what Tesseract gives you, and what it doesn't</title>
      <dc:creator>ocr2excel team</dc:creator>
      <pubDate>Thu, 22 Oct 2026 07:33:41 +0000</pubDate>
      <link>https://dev.to/ocr2excel/table-ocr-in-the-browser-what-tesseract-gives-you-and-what-it-doesnt-3b1e</link>
      <guid>https://dev.to/ocr2excel/table-ocr-in-the-browser-what-tesseract-gives-you-and-what-it-doesnt-3b1e</guid>
      <description>&lt;p&gt;I spent the last few weeks building a tool that turns a photo of a table into an editable Excel file, and I made one decision early that shaped everything else: the OCR had to run in the browser. No upload, no server, no per-page cost.&lt;/p&gt;

&lt;p&gt;That decision is popular with users and painful for the developer. Here is what I learned.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tesseract gives you words, not tables
&lt;/h2&gt;

&lt;p&gt;The single biggest misconception about OCR is that it understands layout. It doesn't. Tesseract returns text blocks, and at the finest level each word comes with a bounding box and a confidence score.&lt;/p&gt;

&lt;p&gt;For a paragraph, that is enough. For a table, it is not. You get a flat bag of words with coordinates, and you have to reconstruct the grid yourself.&lt;/p&gt;

&lt;p&gt;The naive approach - join words with spaces and call it a row - fails immediately on anything with more than two columns, because a wide cell and a narrow cell produce the same output. You lose the only thing that made it a table.&lt;/p&gt;

&lt;p&gt;So the real work is the step after OCR:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Group words into rows by clustering their vertical centers. Words whose y-coordinates overlap within a tolerance belong to the same row.&lt;/li&gt;
&lt;li&gt;Within a row, sort by x, then decide which gaps are column separators and which are just word spacing.&lt;/li&gt;
&lt;li&gt;Build a column model from the whole page, not from one row, or a single badly-aligned row will shift every column after it.&lt;/li&gt;
&lt;li&gt;Merge cells that span multiple columns once the grid is known.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;None of that is part of Tesseract. It is all inference on top of the boxes, and it is where most of the bugs live.&lt;/p&gt;

&lt;h2&gt;
  
  
  The client-side tax
&lt;/h2&gt;

&lt;p&gt;Running OCR in the browser means shipping the engine to the browser. With &lt;code&gt;tesseract.js&lt;/code&gt; that is a WASM build plus trained data, and it is measured in megabytes. On a fast connection it is fine. On a phone on a train it is a cold start the user will notice.&lt;/p&gt;

&lt;p&gt;Three things made this acceptable:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Lazy loading.&lt;/strong&gt; The engine is only fetched when a file is actually dropped. The landing page stays small.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Honest UI.&lt;/strong&gt; A progress bar that reflects the real pipeline stage, not a fake animation. OCR on a dense table is slow, and pretending otherwise makes it feel broken.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No upload claim that is actually true.&lt;/strong&gt; If the file never leaves the device, say it in the first screen, not in a footnote. It is the main reason people pick a browser tool over an API.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The tradeoff is real: a server-side pipeline could use a heavier model and get better accuracy on messy scans. I accepted lower accuracy on hard inputs in exchange for privacy and zero marginal cost per conversion. For clean screenshots and flat photos, the difference is small. For a crumpled receipt shot at an angle, it matters.&lt;/p&gt;

&lt;h2&gt;
  
  
  Your data is not always a number
&lt;/h2&gt;

&lt;p&gt;This one caught me off guard. Spreadsheet users care about what a value &lt;em&gt;looks&lt;/em&gt; like.&lt;/p&gt;

&lt;p&gt;If a cell shows &lt;code&gt;1,314.00&lt;/code&gt;, and your export pipeline parses it as a float, you get &lt;code&gt;1314&lt;/code&gt;. Formatting lost, trailing zeros gone, the thousands separator gone. For a financial statement that is a defect, not a rounding preference.&lt;/p&gt;

&lt;p&gt;The fix was to treat sheet export formats differently:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;XLSX&lt;/strong&gt; - the value is a typed number, and formatting is applied as a cell format. The cell stores &lt;code&gt;1314&lt;/code&gt;, displays &lt;code&gt;1,314.00&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CSV&lt;/strong&gt; - a plain interchange format. Numbers go out as numbers, because something else will parse them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TXT / DOCX&lt;/strong&gt; - these are read by humans, so the original string is preserved verbatim. No float round-trip, no &lt;code&gt;toAoa&lt;/code&gt;-style coercion that quietly rewrites the text.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Writing &lt;code&gt;1,314.00&lt;/code&gt; into a text file is not lazy. It is correct for that destination.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep the structure, not just the text
&lt;/h2&gt;

&lt;p&gt;Merged cells, column widths and number formats are the difference between "a file with the right words in it" and "a spreadsheet someone can keep working in". If the output loses merged headers, the user has to rebuild them by hand, and your tool saved them nothing.&lt;/p&gt;

&lt;p&gt;On the table-reconstruction side that means carrying span information through the pipeline instead of flattening to a uniform grid early. It makes the intermediate representation uglier and the export code simpler, which is the right trade.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I would tell someone starting today
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Do not evaluate an OCR engine on paragraphs if your real input is tables. Test it on the worst table you can find.&lt;/li&gt;
&lt;li&gt;Build the row/column reconstruction as a separate, testable layer. You will rewrite it several times.&lt;/li&gt;
&lt;li&gt;Decide early what each export format is &lt;em&gt;for&lt;/em&gt;. "All formats are equivalent" is how &lt;code&gt;1,314.00&lt;/code&gt; becomes &lt;code&gt;1314&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Measure the client-side cost on a mid-range phone, not on your laptop.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The tool is at &lt;a href="https://ocr2excel.com" rel="noopener noreferrer"&gt;ocr2excel.com&lt;/a&gt; if you want to see the behaviour described above in practice - photos and scans of tables to XLSX, OCR running locally, no account required. Feedback on the hard cases (handwriting, rotated scans, dense financial statements) is genuinely useful, because that is where the reconstruction layer still loses.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;If you have solved the merged-cell case in a more elegant way than "carry spans everywhere", I would like to read about it.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
