<?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: Jalal khan</title>
    <description>The latest articles on DEV Community by Jalal khan (@jalalkhn).</description>
    <link>https://dev.to/jalalkhn</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%2F4103337%2F9f6449bd-409a-44f6-b854-7a24df9bb477.png</url>
      <title>DEV Community: Jalal khan</title>
      <link>https://dev.to/jalalkhn</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jalalkhn"/>
    <language>en</language>
    <item>
      <title>Merge PDFs in the browser with JavaScript (no uploads, no server)</title>
      <dc:creator>Jalal khan</dc:creator>
      <pubDate>Mon, 31 Aug 2026 21:16:19 +0000</pubDate>
      <link>https://dev.to/jalalkhn/merge-pdfs-in-the-browser-with-javascript-no-uploads-no-server-213o</link>
      <guid>https://dev.to/jalalkhn/merge-pdfs-in-the-browser-with-javascript-no-uploads-no-server-213o</guid>
      <description>&lt;p&gt;In this post I'll show how to merge PDF files &lt;strong&gt;entirely in the browser&lt;/strong&gt; using PDF.js and pdf-lib — no server, no file upload, no backend. Everything runs on the user's machine, which is great for privacy and for keeping hosting costs at zero (it's just a static site).&lt;/p&gt;

&lt;h2&gt;
  
  
  Why process PDFs on the client?
&lt;/h2&gt;

&lt;p&gt;Most "free" PDF websites quietly upload your documents to their server, which:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Exposes private/sensitive files to third parties&lt;/li&gt;
&lt;li&gt;Imposes size limits&lt;/li&gt;
&lt;li&gt;Often slaps a watermark on the output&lt;/li&gt;
&lt;li&gt;Requires you to trust their storage&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you handle PDFs with client-side JavaScript (WebAssembly / WASM + PDF.js), none of that happens. The user's file never leaves their device, and you don't need a backend at all — so it's cheap and private.&lt;/p&gt;

&lt;h2&gt;
  
  
  Caveats
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;pdf-lib works well with standard PDFs; heavily encrypted or unusual documents may need extra handling.&lt;/li&gt;
&lt;li&gt;Very large PDFs are memory-hungry since everything is client-side, but for typical documents it's fast and free.&lt;/li&gt;
&lt;li&gt;Some complex PDFs with unusual fonts can lose fidelity — test on your own files first.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;I packaged this approach (plus split, compress, rotate, unlock, image-to-PDF) into a free no-upload tool: &lt;a href="https://yourutilityhub.com/pdf/merge-pdf" rel="noopener noreferrer"&gt;https://yourutilityhub.com/pdf/merge-pdf&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The whole project is open source: &lt;a href="https://github.com/Jalal-khn/utilityhub-" rel="noopener noreferrer"&gt;https://github.com/Jalal-khn/utilityhub-&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you have questions about the architecture or want a deeper dive on any part, ask away.&lt;/p&gt;

&lt;h2&gt;
  
  
  The basic idea
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Read the input file with &lt;code&gt;FileReader&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Parse it with &lt;code&gt;pdf-lib&lt;/code&gt; (a pure-JS PDF library)&lt;/li&gt;
&lt;li&gt;Copy the source pages into a new document&lt;/li&gt;
&lt;li&gt;Save the merged PDF and trigger a download&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here's the core function:&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
js
import { PDFDocument } from "pdf-lib";

async function mergePdfs(files) {
  const merged = await PDFDocument.create();
  for (const file of files) {
    const bytes = await file.arrayBuffer();
    const src = await PDFDocument.load(bytes, { ignoreEncryption: true });
    const pages = await merged.copyPages(src, src.getPageIndices());
    pages.forEach((page) =&amp;gt; merged.addPage(page));
  }
  const out = await merged.save();
  return new Blob([out], { type: "application/pdf" });
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>tutorial</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
