<?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: madhav kumar</title>
    <description>The latest articles on DEV Community by madhav kumar (@madhav_kumar_cc1d644398e0).</description>
    <link>https://dev.to/madhav_kumar_cc1d644398e0</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%2F4169863%2F55ee829f-928d-46b8-b083-029588d717cd.jpg</url>
      <title>DEV Community: madhav kumar</title>
      <link>https://dev.to/madhav_kumar_cc1d644398e0</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/madhav_kumar_cc1d644398e0"/>
    <language>en</language>
    <item>
      <title>Merging PDFs in the browser with pdf-lib (no server upload)</title>
      <dc:creator>madhav kumar</dc:creator>
      <pubDate>Wed, 07 Oct 2026 21:40:41 +0000</pubDate>
      <link>https://dev.to/madhav_kumar_cc1d644398e0/merging-pdfs-in-the-browser-with-pdf-lib-no-server-upload-4a92</link>
      <guid>https://dev.to/madhav_kumar_cc1d644398e0/merging-pdfs-in-the-browser-with-pdf-lib-no-server-upload-4a92</guid>
      <description>&lt;p&gt;Most online PDF mergers upload your file to a server. For sensitive documents, that's a problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  Approach
&lt;/h2&gt;

&lt;p&gt;Use &lt;strong&gt;pdf-lib&lt;/strong&gt; in the browser:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Read files with &lt;code&gt;File.arrayBuffer()&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;PDFDocument.load()&lt;/code&gt; each source&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;copyPages()&lt;/code&gt; into a new &lt;code&gt;PDFDocument&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;save()&lt;/code&gt; and download via a Blob URL&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The PDF never needs to leave the user's device for this flow.&lt;/p&gt;

&lt;h2&gt;
  
  
  Verify privacy
&lt;/h2&gt;

&lt;p&gt;Open DevTools → Network, merge a test PDF, and confirm there's no upload request carrying the file body. After the app loads, you can even try offline.&lt;/p&gt;

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

&lt;p&gt;I packaged this (merge, split, and more) in &lt;strong&gt;PDFCraftify&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Merge tool: &lt;a href="https://pdfcraftify.com/merge-pdf" rel="noopener noreferrer"&gt;https://pdfcraftify.com/merge-pdf&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Guide: &lt;a href="https://pdfcraftify.com/guides/merge-pdf-without-uploading" rel="noopener noreferrer"&gt;https://pdfcraftify.com/guides/merge-pdf-without-uploading&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tradeoffs
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Browser memory limits very large jobs&lt;/li&gt;
&lt;li&gt;Password-protected PDFs must be unlocked first&lt;/li&gt;
&lt;li&gt;Not a replacement for full desktop DTP&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you build similar tools, what edge cases bite you most? Comments welcome.&lt;/p&gt;

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