
Building a Browser-Based PDF Page Organizer with pdf-lib and pdfjs-dist
Building a Browser-Based PDF Page Organizer with pdf-lib and pdfjs-dist Rotate a page, remove a blank one, extract a few pages into a separate file — these are everyday PDF tasks that most tools send to a server. In this post I'll walk through how I built a fully client-side PDF page organizer in Next.js, covering three operations: rotate , remove , and extract pages — all without uploading the file anywhere. The live tool is at ultimatetools.io/tools/pdf-tools/remove-pdf-pages/ and ultimatetools.io/tools/pdf-tools/rotate-pdf/ . The architecture Three libraries do the work: pdfjs-dist — renders each page to a <canvas> for thumbnail preview pdf-lib — manipulates and exports the final PDF @tanstack/react-virtual — virtualizes the thumbnail grid so 100+ page PDFs don't tank performance Zustand — manages all page state with undo/redo The flow: load file → generate thumbnails → user organizes pages → export with pdf-lib. Loading the PDF and generating thumbnails Everything starts with file.
Continue reading on Dev.to Webdev
Opens in a new tab




