{
  "id": 4381938,
  "title": "pdf-lib is silently deleting characters from your users' data",
  "url": "https://urgent.news/2026/08/30/pdf-lib-is-silently-deleting-characters-from-your-users-data",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-08-30T08:26:50.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/stackedboost/pdf-lib-is-silently-deleting-characters-from-your-users-data-51ld"
  },
  "original_language": "en",
  "account": "The article discusses a bug in the pdf-lib library that silently removes characters from user-supplied data in generated PDF documents. The issue occurs when trying to draw non-Latin-1 characters, such as Ł, outside the 1990s WinAnsi encoding table. pdf-lib throws an error for unsupported characters, but the crash is not logged or visible in logs. To resolve the issue, developers should embed a TrueType or OpenType font instead of relying on the default 1990s encoding table. This ensures the document can display a wider range of characters without silent data loss. The article also highlights the importance of caching font reads in serverless functions to avoid unnecessary latency.",
  "summary": "I generate invoices in a Node serverless function with pdf-lib . It is a good library. It also quietly destroyed a client's company name, threw nothing, logged nothing, and produced a PDF that opened perfectly. The name was Łódź Sp. z o.o. The invoice said ód Sp. z o.o. Here is what is going on, because it will hit anyone generating documents from user-supplied text. The standard 14 fonts are…",
  "key_points": [
    "pdf-lib library silently deletes characters from user data in PDF documents",
    "Issue occurs with non-Latin-1 characters outside 1990s WinAnsi encoding",
    "Developers should use TrueType/OpenType fonts to prevent silent data loss"
  ],
  "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."
}