{
  "id": 9847612,
  "title": "How Fillable finds the blanks in a flat PDF form",
  "url": "https://urgent.news/2026/09/25/how-fillable-finds-the-blanks-in-a-flat-pdf-form",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-25T21:50:27.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/nobody_4fb7fd10637d3b88a3/how-fillable-finds-the-blanks-in-a-flat-pdf-form-68g"
  },
  "original_language": "en",
  "account": "A lot of forms still arrive as flat PDFs, requiring printing, filling in by hand, and scanning back. Fillable is an online tool that takes in the PDF, identifies the form fields, corrects mistakes, and charges a one-time fee of $4. The tool works entirely in the browser, and this article explains how it functions. A PDF page doesn't contain individual text fields or lines; instead, it holds a content stream made up of drawing operators like move to, line to, rectangle, stroke, fill, and show this text. The pdf.js library enables replaying this list and tracking every straight line and rectangle drawn. To achieve this, it keeps the graphics state, which includes the current transform matrix, and restores it using q and Q commands. The tool also handles form XObjects, which carry their own matrix. Different form generators create lines in various ways, so the tool rebuilds them as thin filled rectangles and treats rectangles as separate lines meeting at their corners. This second step is crucial for finding cells in ruled tables. The text content of a PDF page is obtained via page.getTextContent(), with each run positioned from the baseline. Two additional rules help classify text as checkboxes or writing lines. Checkboxes are near-square shapes between 6 and 20 points, with the following text as their name. Short options take the question on their row, such as \"Smoker? Yes / No\" becoming smoker_yes and smoker_no. Boxes that are empty become text fields, while those taller than 36 points become multiline fields. If a label is inside the box, the field is placed under or beside it. Boxes containing other boxes are panels, not fields. Empty table cells are named from their column header and row label, while writing lines are split wherever text sits on them, creating two fields. The label is determined by the nearest text to the left, then below, then above. The kind of field is determined by the label. For example, \"Date of birth\" becomes a date field, while \"Signature\" becomes a digital signature field. Number fields are limited to amounts and quantities. The tool also merges overlapping candidates, clamps everything to the page box, and ensures unique field names. For scanned pages with no operators, the process changes to recognize the form. The page is rendered at 2 pixels per point, converted to grayscale, and a black-and-white threshold is determined using Otsu's method. Then, it looks for long dark runs along rows and columns, stacking them into lines with a thickness. Anything thicker than 4 points is considered a filled bar or photo, not a rule. Rectangles are found in the same way as before, and a mostly ink rectangle is discarded. The remaining elements go through the same classifier as drawn forms, with no text recognition involved. If a field lacks a name, it starts unnamed in the editor and can be renamed by selecting it and pressing Enter. A critical aspect of Fillable's performance is straightening tilted pages before searching for lines. To measure tilt, the tool takes dark pixels, rotates them by various angles, and counts how many land on each row. At the right angle, all the pixels of each rule land on the same row, resulting in uneven counts. By summing the squared counts, the tool obtains a score for each angle and tries every 0.05 degrees between -3 and 3, then every 0.01 degrees around the best angle. After straightening, the line and box search, including the entire process, takes approximately 45 milliseconds. The chart in the article illustrates the impact of scanning at different tilts on a sample intake form containing 25 fields. Real forms tend to be messier, which is why every field can be checked and adjusted before payment.",
  "summary": "Originally published at getnobody.org . A lot of forms still arrive as flat PDFs: an intake form, a volunteer application, an order sheet. Nothing on them can be typed into, so people print them, fill them in by pen and scan them back. The tools that add form fields mostly want a monthly plan for something you need once. Fillable is the one-off version: you drop in the PDF, it finds the fields,…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}