<?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: PDF Smart Kit</title>
    <description>The latest articles on DEV Community by PDF Smart Kit (@pdfsmartkit).</description>
    <link>https://dev.to/pdfsmartkit</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%2F4279037%2Ff879c361-fff5-4602-bbbb-68cd26ac988e.png</url>
      <title>DEV Community: PDF Smart Kit</title>
      <link>https://dev.to/pdfsmartkit</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pdfsmartkit"/>
    <language>en</language>
    <item>
      <title>How We Built 35 PDF Tools That Never Upload Your Files</title>
      <dc:creator>PDF Smart Kit</dc:creator>
      <pubDate>Wed, 02 Dec 2026 19:25:37 +0000</pubDate>
      <link>https://dev.to/pdfsmartkit/how-we-built-35-pdf-tools-that-never-upload-your-files-2lcb</link>
      <guid>https://dev.to/pdfsmartkit/how-we-built-35-pdf-tools-that-never-upload-your-files-2lcb</guid>
      <description>&lt;h2&gt;
  
  
  The problem
&lt;/h2&gt;

&lt;p&gt;The deal with most free PDF sites is one you didn't agree to: you drop a contract into a form, it flies to a server you've never heard of, gets processed in a queue, and you download the result while trusting the copy was deleted. For a holiday photo, nobody thinks twice. For the scanned passport, the medical bill, the NDA, it's a bad trade.&lt;/p&gt;

&lt;p&gt;So we built &lt;a href="https://pdfsmartkit.org" rel="noopener noreferrer"&gt;PDF Smart Kit&lt;/a&gt; the other way around: 35 tools, and the server never sees a document. This is how that's structured, what turned out to be interesting about it, and where browser-side processing stops being enough.&lt;/p&gt;

&lt;h2&gt;
  
  
  Architecture: a static site with no document endpoint
&lt;/h2&gt;

&lt;p&gt;The site is a Next.js app built with &lt;code&gt;output: "export"&lt;/code&gt; (&lt;code&gt;next.config.ts:88&lt;/code&gt;) and deployed to Cloudflare Pages through &lt;code&gt;wrangler pages deploy out&lt;/code&gt; (the &lt;code&gt;deploy:cf&lt;/code&gt; script in &lt;code&gt;package.json&lt;/code&gt;). What ships is HTML, CSS, JS, and a few engine assets: &lt;code&gt;public/pdf.worker.min.mjs&lt;/code&gt;, &lt;code&gt;public/standard_fonts/&lt;/code&gt;, &lt;code&gt;public/ocr/&lt;/code&gt;, &lt;code&gt;public/resvg.wasm&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;On &lt;a href="https://pdfsmartkit.org" rel="noopener noreferrer"&gt;pdfsmartkit.org&lt;/a&gt;, the Pages Functions in &lt;code&gt;functions/&lt;/code&gt; are the entire server surface:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;api/feedback.js&lt;/code&gt; — the feedback form (text only, sent through Resend)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;geo.js&lt;/code&gt; — returns the visitor's country code so consent logic knows whether a banner is legally required&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;_middleware.js&lt;/code&gt; — canonical-host 301s, retired-slug redirects, markdown negotiation&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;mcp.js&lt;/code&gt;, &lt;code&gt;a2a.js&lt;/code&gt;, &lt;code&gt;agent/identity.js&lt;/code&gt;, &lt;code&gt;claim.js&lt;/code&gt; — agent protocol endpoints, covered below&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.well-known/http-message-signatures-directory.js&lt;/code&gt; — the bot-auth key directory&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of them has a route that accepts a file. There is no upload endpoint to leak, log, or accidentally cache.&lt;/p&gt;

&lt;p&gt;Processing happens where the file already is. Every tool page renders one client component, &lt;code&gt;src/components/tool-shell/index.tsx&lt;/code&gt;, driven by a declarative registry (&lt;code&gt;src/tools/registry.ts&lt;/code&gt;): slug, category, input/output kinds, and an &lt;code&gt;options&lt;/code&gt; array of typed fields — text, select, range, number, plus &lt;code&gt;showWhen&lt;/code&gt; conditionals so a tool can ask for one thing at a time instead of showing every mode's inputs at once. Clicking run lazily imports &lt;code&gt;runTool()&lt;/code&gt; from &lt;code&gt;src/tools/processors.ts&lt;/code&gt; (&lt;code&gt;index.tsx:1006&lt;/code&gt;), which dispatches on the slug. Heavy page operations — merge, split, rotate, protect, crop — are posted to a module web worker (&lt;code&gt;src/lib/pdf/run-heavy.ts:49&lt;/code&gt;) so the tab stays responsive on a thousand-page scan, with an inline fallback if workers are unavailable or crash.&lt;/p&gt;

&lt;p&gt;The libraries are all local: &lt;a href="https://mozilla.github.io/pdf.js/" rel="noopener noreferrer"&gt;pdf.js&lt;/a&gt; for rendering and text extraction, &lt;a href="https://pdf-lib.github.io/" rel="noopener noreferrer"&gt;pdf-lib&lt;/a&gt; for page-level surgery, mammoth's browser build for &lt;code&gt;.docx&lt;/code&gt;, &lt;code&gt;xlsx&lt;/code&gt; for spreadsheets, pptxgenjs for slides, JSZip for containers, tesseract.js for OCR, resvg-wasm for SVG-to-PNG. The data path is &lt;code&gt;File → arrayBuffer → worker → Blob → download&lt;/code&gt; (with an inline fallback when workers are unavailable). Grep &lt;code&gt;fetch(&lt;/code&gt; across &lt;code&gt;src/&lt;/code&gt; finds five call sites in app code: &lt;code&gt;/geo&lt;/code&gt;, &lt;code&gt;/api/feedback&lt;/code&gt;, an image URL the user pasted, a same-origin asset, and an external image referenced by HTML the user is converting. None of them carries document bytes.&lt;/p&gt;

&lt;h2&gt;
  
  
  The engineering that was actually interesting
&lt;/h2&gt;

&lt;h3&gt;
  
  
  A strict CSP that still lets WASM run
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;public/_headers:8&lt;/code&gt; ships one CSP for the whole origin: &lt;code&gt;default-src 'self'&lt;/code&gt;, &lt;code&gt;object-src 'none'&lt;/code&gt;, &lt;code&gt;frame-ancestors 'none'&lt;/code&gt;, and a &lt;code&gt;script-src&lt;/code&gt; of &lt;code&gt;'self' 'unsafe-inline' 'wasm-unsafe-eval' blob: …&lt;/code&gt;. The token that matters is &lt;code&gt;wasm-unsafe-eval&lt;/code&gt;. Under a strict CSP, &lt;code&gt;WebAssembly.compile&lt;/code&gt;/&lt;code&gt;instantiate&lt;/code&gt; is blocked the same way &lt;code&gt;eval()&lt;/code&gt; is — and every engine here is WASM: pdf.js's image decoders, tesseract's OCR core, resvg. &lt;code&gt;wasm-unsafe-eval&lt;/code&gt; reopens exactly that one door, and only that one door: WebAssembly instantiation is allowed, JavaScript &lt;code&gt;eval()&lt;/code&gt; stays blocked. The rest of the line is load-bearing too — &lt;code&gt;worker-src 'self' blob:&lt;/code&gt; covers the module worker and the OCR worker, and &lt;code&gt;blob:&lt;/code&gt; in &lt;code&gt;frame-src&lt;/code&gt; is for the print iframe.&lt;/p&gt;

&lt;h3&gt;
  
  
  A service worker that refuses to pin you to an old build
&lt;/h3&gt;

&lt;p&gt;Navigations are network-first (&lt;code&gt;public/sw.js:75&lt;/code&gt;). Deployments are frequent and the HTML embeds hashed asset names plus inline CSS, so cache-first HTML would hand returning visitors a stale shell against new &lt;code&gt;/_next/static&lt;/code&gt; files. The cached copy exists only as an offline fallback, and a 5xx falls back to what that visitor already had rather than to an error page. Two more caches ride alongside: App Router flight payloads (keyed with the &lt;code&gt;_rsc&lt;/code&gt; cache-buster stripped) and &lt;code&gt;/pdf.worker.min.mjs&lt;/code&gt; itself, so a connection that drops mid-session can still open a document instead of failing pdf.js's dynamic import.&lt;/p&gt;

&lt;p&gt;The rule the code enforces is that no branch may reject — every path settles on a Response, the network's, the cache's, or a synthesized offline page built from inline styles and a data-URI favicon (a favicon that 404s offline shows a blank tab). The real &lt;code&gt;sw.js&lt;/code&gt; is executed under &lt;code&gt;node:vm&lt;/code&gt; with mocked caches in &lt;code&gt;src/lib/service-worker.test.ts&lt;/code&gt;, so the offline-navigation contract is tested against the file that actually ships.&lt;/p&gt;

&lt;h3&gt;
  
  
  35 tools, one shell, one pipeline
&lt;/h3&gt;

&lt;p&gt;The registry is the product: 10 Organize, 4 Edit, 19 Convert, 2 Security — 35 entries, each a plain object carrying SEO titles, HowTo steps and FAQs next to &lt;code&gt;input&lt;/code&gt;, &lt;code&gt;output&lt;/code&gt; and &lt;code&gt;options&lt;/code&gt;. The shell reads that declaration and builds the form, the validation, the result panel and the download; &lt;code&gt;runTool()&lt;/code&gt; is a switch over slugs. Adding a tool is mostly data entry. An agent-facing catalog mirrors the registry and a test keeps the two in lockstep (&lt;code&gt;src/lib/agent-tools.test.ts&lt;/code&gt;), so a new tool cannot ship without the endpoints knowing about it. The UI side is covered by 31 Playwright spec files that run on Chromium, WebKit and Firefox on every run (&lt;code&gt;playwright.config.ts&lt;/code&gt;).&lt;/p&gt;

&lt;h3&gt;
  
  
  Agent endpoints on a site with no backend
&lt;/h3&gt;

&lt;p&gt;This is the part we didn't expect to be novel. &lt;code&gt;functions/mcp.js&lt;/code&gt; is a stateless MCP server over Streamable HTTP — &lt;code&gt;initialize&lt;/code&gt;, &lt;code&gt;tools/list&lt;/code&gt;, &lt;code&gt;tools/call&lt;/code&gt; — advertising two tools that search the catalog and hand back tool URLs. &lt;code&gt;functions/a2a.js&lt;/code&gt; answers JSON-RPC &lt;code&gt;message/send&lt;/code&gt; with a routing message and serves an agent card on GET. Both read from &lt;code&gt;src/lib/agent-tools.ts&lt;/code&gt;, and both are deliberately limited: they cannot receive or process a file, and the code says so out loud. A static site running an MCP endpoint is odd; a static site whose MCP endpoint &lt;em&gt;can't&lt;/em&gt; touch documents is the only honest shape for this architecture.&lt;/p&gt;

&lt;p&gt;The same idea shows up in content negotiation. &lt;code&gt;scripts/build-markdown.mjs&lt;/code&gt; writes a &lt;code&gt;.md&lt;/code&gt; sibling for every exported page at build time, and &lt;code&gt;functions/_middleware.js:95&lt;/code&gt; serves it when a request arrives with &lt;code&gt;Accept: text/markdown&lt;/code&gt;. Browsers never send that header for navigations; agents do. Conversion happens at build time, so request-time CPU stays at zero on the free plan — the middleware only ever serves a file it already has.&lt;/p&gt;

&lt;h2&gt;
  
  
  Honest limits
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Memory, not quotas.&lt;/strong&gt; With no server queue to offload to, the ceiling is the device. Inputs above 1 GiB are rejected before they can crash the tab (&lt;code&gt;MAX_TOTAL_INPUT_BYTES&lt;/code&gt;, &lt;code&gt;src/components/tool-shell/constants.ts:88&lt;/code&gt;), and the error mapper turns the browser's "out of memory" into plain language.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The tab has to stay open.&lt;/strong&gt; No background jobs, no "convert while you're away", no server-side history. Close the tab and the run is gone.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OCR is English-only and pays a cold start.&lt;/strong&gt; The worker loads &lt;code&gt;eng&lt;/code&gt; traineddata from our own origin (&lt;code&gt;src/lib/pdf/ocr.ts:44&lt;/code&gt;); first use fetches a ~4.7 MB WASM core and ~11 MB of gzipped trained data, so the first recognition takes seconds and later runs don't.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"No upload" is not "no network."&lt;/strong&gt; Assets come from our origin, Cloudflare's analytics beacon is injected into Pages HTML, and GA4 loads only after consent, with events limited to a fixed vocabulary that never includes file names. Two features fetch a URL on your behalf — an image you paste, and external images inside HTML you're converting — and both need the remote host to allow the read: the pasted image is held to the same 1 GiB input ceiling, the HTML-embedded ones to 10 MB and 15 seconds.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No account means no sync.&lt;/strong&gt; Nothing to log into is the privacy feature; it's also why there's no cross-device history to restore.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;Everything above is the same claim you can verify with devtools open: pick a file, watch the network tab, and see that no request carries it. The tools are at &lt;a href="https://pdfsmartkit.org" rel="noopener noreferrer"&gt;pdfsmartkit.org&lt;/a&gt; — merge, split, compress, convert, protect, and the rest of the 35, free and with no sign-up.&lt;/p&gt;

&lt;p&gt;— PDF Smart Kit (pdfsmartkit.org)&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>privacy</category>
      <category>pdf</category>
    </item>
  </channel>
</rss>
