October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk5 min

Node.js Document Previews: Verifying Signed Watermarks Beyond the First PDF Page

A preview watermark is not proof that a signed PDF contains it. Here is how to apply watermarks before signing and verify every page of the file you deliver.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A watermark you see in a Node.js document preview does not prove that the PDF file contains that watermark, and it does not prove the watermark is covered by a digital signature. Preview rendering, PDF modification, and signing are three separate operations. If the requirement is signed evidence, you have to decide which PDF bytes must carry the watermark, add the watermark to those bytes before signing, sign the finalized file, and then check pages beyond the first one in the file you actually deliver.

Why a preview watermark is not evidence

A preview is produced by a renderer that draws pages on screen. Many viewers let an application paint an overlay during that drawing step. PDF.js Express, for example, documents a viewer watermark feature that draws text or custom content on each page and passes the page number to a custom callback. That is a presentation layer. The source PDF is not altered, so a watermark that appears in the viewer can be absent from the file a user downloads.

As an Amazon Associate I earn from qualifying purchases.

The opposite is also true. A PDF can contain a watermark that the preview never shows, for instance when the preview only renders the first page, caches an earlier version, or loads a copy made before the watermark step ran. Check the file itself.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Keep three operations apart

Operation What it changes Covered by a cryptographic signature? What to verify
Preview overlay in the viewer Screen rendering only; the PDF bytes stay the same No. Nothing in the file changes Visual check only; it cannot establish file content
Watermark written into the PDF before signing The saved PDF bytes, before the signature is applied Yes, if the signature covers the finalized file Each page of the signed file, plus signature validity
Watermark appended after signing A new incremental revision placed after the signed bytes No. The original signed revision does not include it Whether the change is reported as a post-signature modification

The table makes the main design decision explicit. If you want the watermark to be part of the signed evidence, it must exist before the signature is computed. A watermark added later can be displayed to users, but it sits outside the signed revision.

#1 Best Overall
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
  • Scanner type: Document
  • Connectivity technology: USB
  • With Auto Scan Mode, the scanner automatically detects what you're scanning
  • Digitize documents and images

What a PDF signature actually covers

According to the PDF 32000-1:2008 standard, signature validation recalculates a digest over the signature’s byte range and compares it with the stored digest. A valid signature therefore vouches for the specific bytes inside that range, which is one revision of the document.

The same standard allows an incremental update: a signed document can be modified by appending data, and the bytes for the original signed range are kept. That lets a reader reconstruct the document as it was at signing time. It does not mean every later revision is the signed state. A reader who opens the latest revision is looking at the file after any appended changes, so the signed revision and the displayed revision can differ. When you describe the evidence to users, name the revision the signature covers.

Rank #2
Sale
Brother DS-640 Compact Mobile Document Scanner, (Model: DS640)
  • FAST SPEEDS - Scans color and black and white documents a blazing speed up to 16ppm (1). Color scanning won’t slow you down as the color scan speed is the same as the black and white scan speed.
  • ULTRA COMPACT – At less than 1 foot in length and only about 1. 5lbs in weight you can fit this device virtually anywhere (a bag, a purse, even a pocket).
  • READY WHENEVER YOU ARE – The DS-640 mobile scanner is powered via an included micro USB 3. 0 cable allowing you to use it even where there is no outlet available. Plug it into you PC or laptop and you are ready to scan.
  • WORKS YOUR WAY – Use the Brother free iPrint&Scan desktop app for scanning to multiple “Scan-to” destinations like PC, Network, cloud services, Email and OCR. (2) Supports Windows, Mac and Linux and TWAIN/WIA for PC/ICA for Mac/SANE drivers. (3)
  • OPTIMIZE IMAGES AND TEXT – Automatic color detection/adjustment, image rotation (PC only), bleed through prevention/background removal, text enhancement, color drop to enhance scans. Software suite includes document management and OCR software. (4)

Choosing the tools

pdf-lib: PDF editing in Node.js

pdf-lib runs in Node.js and can load, modify, and save PDFs, including drawing text and images onto pages. Its PDFSignature API documentation, which dates from several years ago, states: “pdf-lib does not currently provide any specialized APIs for creating digital signatures or reading the contents of existing digital signatures.” Treat pdf-lib as the component that writes the watermark. Check the current package release before relying on that documentation, since the API may have changed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A minimal watermark pass that places text on every page looks like this:

Rank #3
Plustek PS186 Desktop Document Scanner, with 50-Pages Auto Document Feeder (ADF). for Windows 7/8 / 10/11 (Intel/AMD only)
  • Up to 255 customize favorite scan file setting with "Single Touch" , Support Windows 7/8/10
  • Turn paper documents into searchable, editable files - save scans as searchable PDF files; OCR function included
  • Info Barcode function - automatic categorization of complicate documentation and data with 1D or 2D Barcode page.
  • Intelligent color and image adjustments — Auto Rotate, Crop, Deskew and blank page remove with Plustek Image Processing Technology
  • Easy send scanned files to FTP server or personal NAS (FTP) with PDFs , Jpeg , TIFF or Png format. User can download scanner driver from Plustek website
import { PDFDocument, rgb, StandardFonts } from 'pdf-lib';

const pdfDoc = await PDFDocument.load(inputBytes);
const font = await pdfDoc.embedFont(StandardFonts.Helvetica);

for (const page of pdfDoc.getPages()) {
  const { width, height } = page.getSize();
  page.drawText('CONFIDENTIAL', {
    x: width / 4,
    y: height / 2,
    size: 48,
    font,
    color: rgb(0.6, 0.6, 0.6),
    opacity: 0.3,
  });
}

const watermarkedBytes = await pdfDoc.save();

The loop over getPages() is what gives every page the mark. A single getPage(0) call is the most common reason a watermark appears only on the first page. The bytes returned by save() are the input to the signing step.

sign-pdf-lib: signing with an integrity check

The npm listing for sign-pdf-lib describes signing and signature integrity checking. Its verification function, as described on that page, confirms only that the document has not changed since signing. That does not establish certificate trust, signer identity, revocation status, timestamp validity, or conformance to the wider standard. Test those properties separately with a validator before you present the output as trustworthy evidence.

Rank #4
Hczrc Portable Scanner, Photo Scanner for A4 Documents, Handheld Scanner for Business, Photo, Picture, Receipts, Books, JPG/PDF Format Selection, UP to 900 DPI, with 16G SD Car
  • Note: No software installation is required. You need 2 AA batteries ( not included) and a memory card ( included) to use it directly. Scan mode: Press and hold "Scan" for 2 seconds to turn on the device, and then press "Scan", the green light is on. The scanner moves to scan the file until the green light turns off automatically (or press the "Scan" key and the green light goes out). The number shown on the display increases by 1 to indicate that the scan is complete.
  • Portable Scanner scans images or pictures quickly: Store JPEG/PDF files within seconds, scan images or pictures quickly, plug and play, no need any software preinstalled. Compatible with Windows XP/7/Vista/Mac OS 10.4 or above version.
  • Lightweight and travel-friendly: Stored in Micro SD card directly, support read data on your computer or phone with USB connected. Powered by 2pcs AA batteries, Compact Design, it is convenient to carry outside.
  • 3 Image Resolution: 3 modes of resolution for your options: 300dpi/600dpi/900dpi, you can save it at the clearest way, picture and document are showed clear as it is. Freely choose your favorite resolution.File Format: JPEG/PDF format is all available, Great storage capacity as it supports 32G Micro SD card(Included 16GB Card),total meet your need for business trip or daily use.
  • Widely Used: It is applicable in bank, insurance business, real estate agency,home, office, library or outdoors. suitable for lawyer, businessmen, students, travelers and amateur archivists. Scan your important files and save them immediately, no struggling in finding a printing shop, keep it confidential.

PDF.js Express: viewer and document watermarks

PDF.js Express documents two different watermark features. The viewer watermark is drawn on screen and receives a page number in its custom callback, which supports per-page content in the preview. A separate REST endpoint adds a watermark to the document itself. Use the REST route, or a step like the pdf-lib pass above, when the output must be a watermarked file. Its signature tool creates freehand or ink annotations, which are visual marks. Its digital-signature features are documented separately, and a visual mark is not a cryptographic signature.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Checking pages beyond the first

Page coverage is an implementation requirement, not something the tools guarantee. Verify it on the output file.

Best Value
Sale
Epson Workforce ES-50 Compact & Lightweight Mobile Document Scanner
  • PORTABLE SCANNER FOR USE ON-THE-GO — The fastest and lightest mobile single-sheet-fed compact document scanner in its class¹
  • QUICK DOCUMENT SCANNING ― This Epson ultra-fast scanner scans a single page as quickly as 5.5 seconds²; Windows and Mac compatible
  • VERSATILE PAPER HANDLING ― Portable scanner scans documents up to 8.5 x 72 in; Also easily digitizes receipts and ID cards to make accounting, bookkeeping, and organizing simpler
  • INTUITIVE, HIGH-SPEED SOFTWARE — Epson ScanSmart Software³ is a smart tool allowing you to easily scan, review, and save; Stay organized easily with the help of this Epson scanner
  • EASY SETUP — USB-powered connect to your computer for quick and simple scanning; No batteries or external power supply required to operate portable document scanner; Standard Connectivity: USB 2.0
  1. Decide the required coverage: a representative check (first, middle, and last page) or every page. Use every page for anything that will be relied on as evidence.
  2. Apply the watermark to the document bytes, then save them. Confirm the page count with pdfDoc.getPageCount() before and after the pass.
  3. Render the saved file with an independent renderer. For example, run pdftoppm -r 50 -png watermarked.pdf check and open check-1.png, a middle page, and the last page, or every generated image when full coverage is required.
  4. Sign the finalized bytes with a component that explicitly supports PDF digital signatures. Do not sign a copy that differs from the file you deliver.
  5. Run signature validation on the signed file. The poppler utility pdfsig signed.pdf reports signature status; read the full output rather than a single pass or fail line, and confirm the validator’s trust and timestamp results against your requirements.
  6. Render the signed file again. A watermark that appears in the preview but is missing from this render indicates a preview-only overlay.

Failure modes to check

  • Watermark on page 1 only. The code applies the mark to a single page object, or the preview renders only the first page.
  • Watermark visible in the viewer but not in the file. The mark is a viewer overlay, not a PDF modification.
  • Signature reports a post-signature change. A watermark or other edit was appended after signing. Re-run the pipeline so the watermark happens before the signature.
  • Signature valid but watermark missing on later pages. The signature covers the file as produced; the file was produced without full-page coverage. The signature is accurate, and the watermark step is the defect.

Evidence to keep

  • The exact signed PDF, stored unchanged, with its hash.
  • The tool and library versions used for watermarking and signing.
  • The signature validation output and the validator version.
  • Per-page render images for the pages you checked, if your application generates them. Retain them only when the pipeline actually produces them.

The PDF-LIB documentation and the PDF 32000-1:2008 standard are primary references for the behavior described above. Package listings and product documentation change, so confirm current behavior before implementing.

The Bottom Line

“”

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.