<?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: Witplay Tools</title>
    <description>The latest articles on DEV Community by Witplay Tools (@witplaytools).</description>
    <link>https://dev.to/witplaytools</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%2F4286649%2Fa772187c-3163-4521-83e3-c64dc61305d9.png</url>
      <title>DEV Community: Witplay Tools</title>
      <link>https://dev.to/witplaytools</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/witplaytools"/>
    <language>en</language>
    <item>
      <title>Shipping browser PDF tools that never upload your file</title>
      <dc:creator>Witplay Tools</dc:creator>
      <pubDate>Sun, 06 Dec 2026 16:11:35 +0000</pubDate>
      <link>https://dev.to/witplaytools/shipping-browser-pdf-tools-that-never-upload-your-file-c58</link>
      <guid>https://dev.to/witplaytools/shipping-browser-pdf-tools-that-never-upload-your-file-c58</guid>
      <description>&lt;p&gt;Most "free online PDF tools" work the same way: you upload the file to someone's server,&lt;br&gt;
a quality slider appears, and you hope the export lands under the limit the portal wants&lt;br&gt;
(100 KB for a form, 2 MB for an email attachment). I wanted the opposite: tools where the&lt;br&gt;
file never leaves the tab, and the size cap is an input, not a slider you guess with.&lt;/p&gt;

&lt;p&gt;Three things made that harder than it looks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. The PDF worker has to be inlined, or file:// breaks.&lt;/strong&gt;&lt;br&gt;
pdf.js runs most of its parsing in a worker loaded by URL. A single-file build has no&lt;br&gt;
sibling files to load, so the worker is inlined as a Blob and &lt;code&gt;GlobalWorkerOptions.workerSrc&lt;/code&gt;&lt;br&gt;
is pointed at &lt;code&gt;URL.createObjectURL(blob)&lt;/code&gt;. The catch: on &lt;code&gt;file://&lt;/code&gt; the document origin is&lt;br&gt;
opaque, and a few engines refuse Blob workers there. Wrapping the worker source in a plain&lt;br&gt;
&lt;code&gt;data:&lt;/code&gt; URL avoided that for me, at the cost of a slightly larger bootstrap. pdf-lib has no&lt;br&gt;
worker, so merge/split stayed simple: copy pages instead of re-rendering, which keeps text&lt;br&gt;
selectable and keeps file size predictable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. "Compress to 100 KB" is a search problem, not a quality setting.&lt;/strong&gt;&lt;br&gt;
Every online compressor asks for a percentage. What people actually need is "make it fit".&lt;br&gt;
So the tool does a bounded search: encode at high quality, if it overflows step quality down;&lt;br&gt;
when quality alone cannot fit (a 4000 px scan at q=0.4 is still 2 MB), step resolution down&lt;br&gt;
in 10% increments and retry. Cap the loop at ~10 encodes and stop at the first result under&lt;br&gt;
the target, remembering the last good one. Worst case measured here: a 10.5 MB PNG of pure&lt;br&gt;
noise becomes a 96 KB JPEG at target 100, in about four seconds in a normal tab.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. HEIC is a library you must ship, not a format the browser knows.&lt;/strong&gt;&lt;br&gt;
Safari decodes HEIC; Chrome does not. heic2any pulls in libheif, and it is heavy, which is&lt;br&gt;
why the concatenated single file for the converter is 3.6 MB. It is worth it: a user drags an&lt;br&gt;
iPhone photo in, gets a JPEG at the original pixel dimensions, no server round trip.&lt;/p&gt;

&lt;p&gt;The result is a folder of HTML files you double-click. No install, no admin rights, no&lt;br&gt;
account, no telemetry, works on a plane. Libraries inlined means the first run is also the&lt;br&gt;
only load.&lt;/p&gt;

&lt;p&gt;If you want to poke at it, the image compressor version is running free on GitHub Pages:&lt;br&gt;
&lt;a href="https://witplay.github.io/offline-tools/" rel="noopener noreferrer"&gt;https://witplay.github.io/offline-tools/&lt;/a&gt; — drag a big photo in, set the KB cap, watch it search.&lt;/p&gt;

&lt;p&gt;The offline single-file builds and the PDF/HEIC tools are paid, since each one gets tested&lt;br&gt;
against real portal caps: &lt;a href="https://witplay.gumroad.com/l/offline-document-kit" rel="noopener noreferrer"&gt;https://witplay.gumroad.com/l/offline-document-kit&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;(I am not going to pretend this is a startup — it is three tools I got tired of uploading&lt;br&gt;
contracts to random websites to use.)&lt;/p&gt;

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