{
  "id": 7058824,
  "title": "Three things that bit us moving a document scanner fully into the browser",
  "url": "https://urgent.news/2026/09/13/three-things-that-bit-us-moving-a-document-scanner-fully-into-the",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-13T03:55:14.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/yanwang/three-things-that-bit-us-moving-a-document-scanner-fully-into-the-browser-15cc"
  },
  "original_language": "en",
  "account": "1. Web Share API can become unavailable\nWhen generating a multi-page PDF from full-resolution photos on a mid-range phone, the process may take too long for the transient user activation required by the Web Share API to still be active by the time the file is ready. This results in a \"NotAllowedError,\" and the share sheet never opens. This failure is more likely to occur on slow devices.\n\nTo mitigate this issue, the workflow can be decoupled, with the PDF preparation happening first and then checking whether the user's activation is still present before attempting to share. If the activation has expired, a toast message can inform the user to tap share again.\n\n2. Feature-detect the file sharing option\nWhen sharing the generated PDF, it is crucial to check whether the device supports sharing files. The navigator object's `canShare` property indicates whether the device supports file sharing, but it does not specify whether the specific `application/pdf` file type is supported. Therefore, a separate probe is needed to build a real File object with the PDF MIME type `%PDF` and test if it can be shared.\n\nIf the device does not support sharing files of the intended type, the share button can be hidden to avoid confusion or errors.\n\n3. AbortError is a normal outcome\nWhen the user dismisses the share sheet without selecting an action, the `navigator.share()` method will throw an `AbortError`. This error is expected and should not be considered an indication of a failure. Instead of displaying a toast message or presenting it as a failure, the `AbortError` should be caught and handled appropriately, as it signifies that the user decided to cancel the share operation.",
  "summary": "Photographing a page and turning it into a clean, printable PDF is, on paper, a solved problem: read a file, fix the perspective on a canvas, flatten the shading, write a PDF. Browsers have shipped every primitive for that for years, and none of it needs a server. I work on LensUp , which does exactly that — the whole pipeline runs in the tab, and files are never uploaded. Disclosure up front:…",
  "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."
}