When you fill out a PDF form and send it to someone, the recipient can still clear your entries, change your answers, or delete annotations — unless you flatten the document first. Flattening merges all interactive layers (form widget appearances, annotation overlays, digital signature stamps) into the static page content stream. The result is a PDF with no editable objects: no form fields to clear, no annotation layers to hide, no way to alter what you wrote. This is the correct step before archiving a signed contract, filing a government form, or submitting a completed application — not just covering fields visually, but removing their editability from the PDF structure itself.
LuraPDF offers two distinct flatten modes to match different output requirements. Vector flatten uses pdf-lib to walk the PDF's page content streams, merge widget appearance streams into the page, and remove the annotation and AcroForm objects. The result is a text-layer-intact PDF — all text remains selectable, searchable, and copyable, and file size is often smaller than the original. Raster flatten takes a different approach: pdf.js renders each page to a canvas at high resolution, and pdf-lib writes each rendered image back as a full-page JPEG or PNG embedded in a new PDF. Every annotation, form field, graphic, and font appearance is captured in the pixel render — what you see is exactly what the output contains. This guarantees visual fidelity across all viewers but trades away text searchability. Both modes run entirely in your browser — nothing is uploaded.