PDF Watermark Studio is a local-first web app for adding tiled text watermarks to every page of a PDF. It runs entirely in the browser, previews the first five pages, and lets users adjust watermark text, color, size, spacing, and opacity before generating a new PDF.
- PDF files are read in the browser and are never uploaded by the app.
- The app does not load dependencies from a CDN at runtime. Vite bundles
pdf-lib,pdfjs-dist, and app code into static assets. - Watermark configuration is saved with
localStorageso the next visit restores the last text, color, size, spacing, and opacity values. - Selected PDF files and generated PDF bytes are not stored in
localStorage.
The app is a static Vite application with no backend service.
index.htmldefines the application shell, form controls, preview canvas, language switcher, and footer.src/app.jsowns browser event handling, PDF preview rendering, localized UI updates, and download generation.src/watermark-core.mjscontains shared watermark defaults, validation, layout helpers, preview page limits, quick colors, and file-name generation.src/pdf-watermark.mjsusespdf-libto embed the selected PDF, draw the watermark tiles on every page, and serialize the output PDF.src/settings-storage.mjspersists only normalized watermark settings in browserlocalStorage.src/i18n.mjsprovides English and Chinese UI strings.src/styles.csscontains the responsive two-column tool layout and scrollable multi-page preview area.tests/contains lightweight Node-based tests for configuration, i18n parity, layout constraints, storage behavior, and watermark helpers.
PDF preview uses pdfjs-dist to render pages into canvas images. PDF output uses pdf-lib to edit the original PDF bytes. This split keeps preview rendering and PDF writing explicit and testable.
- Node.js
^20.19.0or>=22.12.0 - npm
Install dependencies:
npm installStart the development server:
npm run devRun tests:
npm testBuild the static site:
npm run buildPreview the production build:
npm run preview