Scan to PDF
Turn your smartphone rear camera or desktop webcam into a zero-upload document scanner with real-time luminance enhancement, B&W contrast filtering, page rotation, and multi-page PDF compilation.
5 Camera Photos of PaperReady locally via WebAssembly & JavaScript
1 Clean, Multi-Page PDF100% Client-Side • Zero Server Upload
Dedicated mobile scanning apps routinely gate multi-page exports behind subscriptions or upload private financial paperwork, tax statements, and identity documents to remote cloud pipelines for enhancement. Modern web browsers already expose the hardware sensors and pixel-manipulation primitives needed to digitize physical paperwork locally. NexusCalculator's Scan to PDF engine combines the W3C Media Capture API, pixel-level luminance filtering on HTML5 Canvas, and pdf-lib binary compilation to turn any smartphone rear camera or desktop webcam into a zero-upload document scanner.
Camera Acquisition Through the Web MediaDevices API
When you activate live capture, the scanner invokes navigator.mediaDevices.getUserMedia() with hardware constraints tailored for physical documents:
facingMode: "environment": Requests the high-resolution autofocus rear lens on Android and iOS handsets instead of the lower-resolution front selfie camera, while falling back automatically to the default webcam on laptops and desktops.width: { ideal: 1920 }, height: { ideal: 1080 }: Negotiates a 1080p Full HD video stream (roughly 2.07 megapixels per frame) whenever the camera sensor supports it, ensuring 10-point contract body copy remains legible after scaling onto A4 or US Letter paper.
Tapping the shutter snaps the live <video> element directly at its native video.videoWidth × video.videoHeight sensor dimensions—not the smaller CSS viewport size—preventing accidental downsampling before filtering begins. Closing camera mode or navigating away invokes track.stop() on every active MediaStreamTrack so the hardware camera LED switches off immediately.
Luminance Weighting and Document Contrast Enhancement
Raw camera photos of white paper rarely look white: ambient tungsten bulbs tint sheets yellow, fluorescent overheads cast greenish-gray gradients, and smartphone auto-exposure settles paper luminance near 180–210 instead of pure 255. Sending unenhanced snapshots straight to a printer wastes toner on gray backgrounds and reduces readability.
Inside the B&W Thresholding Pipeline
Every captured or uploaded page runs through an offscreen Canvas 2D pixel loop using ITU-R BT.601 luma coefficients (0.299, 0.587, 0.114) that reflect human eye sensitivity to red, green, and blue light:
for (let i = 0; i < data.length; i += 4) {
const gray = data[i] * 0.299 + data[i + 1] * 0.587 + data[i + 2] * 0.114;
if (filter === "grayscale") {
data[i] = data[i + 1] = data[i + 2] = gray;
} else if (filter === "bw") {
// High-contrast document mode: bleach paper above 140, deepen ink by 30%
const value = gray > 140 ? 255 : gray * 0.7;
data[i] = data[i + 1] = data[i + 2] = value;
}
}
Rather than hard 1-bit binary thresholding (which turns anti-aliased letter edges jagged), multiplying dark pixels below 140 by 0.7 deepens ink density while preserving subtle edge anti-aliasing—simulating a clean office photocopier without shattering serif fonts.
Choosing the Right Scan Filter for Receipts, Contracts, and IDs
Because different physical media respond differently to fixed luminance clipping, you can set a global default filter and still override individual pages non-destructively:
| Scan Filter Mode | Pixel Transformation | Background Noise Removal | Relative PDF Size | Best Physical Source Documents |
|---|---|---|---|---|
B&W Document (bw) | BT.601 luma; > 140 → 255, ≤ 140 → 0.7 × gray | High — clips off-white paper to #FFFFFF | Smallest (flat white runs compress efficiently) | Laser contracts, invoices, faded thermal receipts, black ink notes |
Grayscale (grayscale) | Continuous 8-bit BT.601 luminance (0–255) | Moderate — strips color casts, keeps shading | Medium | Pencil drawings, shaded tables, watermarks, unevenly lit book pages |
Original (original) | Untouched 24-bit RGB sensor capture | None — preserves exact ink and photo hues | Largest | Passports, driver's licenses, blue wet-ink signatures, color stamps |
Once you compile a scanned document into a PDF, remember that camera captures contain raster pixels rather than selectable text. To index or copy text from scanned contracts, run the exported file through PDF OCR. If your scan captures a driver's license or bank statement containing account numbers you need to hide permanently before emailing, apply opaque blackouts with Redact PDF.
Non-Destructive Page Management and Print-Ready Compilation
Each entry in the scanner queue stores two distinct buffers: originalDataUrl (the pristine captured frame) and processedDataUrl (the rendered JPEG at 0.85 quality). Whenever you rotate a page by 90 degrees or toggle between B&W, Grayscale, and Original, the engine recomputes from originalDataUrl. That non-destructive architecture eliminates generational JPEG degradation even if you rotate and re-filter a page multiple times.
Drag-and-drop sequence ordering lets you interleave newly snapped pages with uploaded gallery images effortlessly. During export, pdf-lib embeds every processed page into a fresh PDF container: A4 and US Letter modes scale each scan proportionally inside a consistent 20 pt margin for clean office printing, whereas Fit mode creates zero-margin pages matching exact pixel dimensions—preventing tall narrow store receipts from shrinking into tiny slivers. Need to countersign a paper agreement right after scanning it? Drop the compiled PDF directly into Sign PDF.
Field Capture Best Practices and Camera Troubleshooting
- Prevent Shadow Clipping Under B&W Mode: If a heavy phone shadow crosses a page and drops local paper luminance below
140, the B&W filter will darken that shadowed patch instead of bleaching it white. Shoot near indirect window light or tilt the sheet slightly away from overhead lamps—or toggle that specific page toGrayscale. - Fill the Frame and Hold Parallel: On a
1920 × 1080capture, framing an A4 sheet so it fills 90% of the height yields roughly150–165effective PPI, which stays crisp for both print and OCR. Hold your phone parallel to the tabletop and wait half a second for continuous autofocus to lock before tapping capture, avoiding keystone distortion and motion blur on fine print. - HTTPS Context Requirement: Modern browsers block
navigator.mediaDevices.getUserMedia()on insecurehttp://origins or when embedded inside restrictive cross-origin iframes withoutallow="camera". If a corporate laptop lacks a webcam or restricts permissions, use the Upload button to batch-process photos transferred from your phone instead.
How to Use Scan to PDF
Click Start Camera and grant browser camera access (or click Upload Photos to import existing document images from disk or gallery).
Choose a default Scan Filter (B&W Document for text and receipts, Grayscale for shaded forms, or Original for color stamps and IDs).
Align each paper sheet under even lighting and tap the shutter button repeatedly to capture all pages into your local queue.
Drag page thumbnails into the right reading order, rotate sideways shots in 90-degree steps, and override individual page filters if needed.
Select A4, US Letter, or Fit page sizing, click Compile PDF, and download your timestamped multi-page PDF document.
Real Examples
Scanning a Multi-Page Contract
A user photographs a 5-page legal contract using their smartphone camera. They apply the B&W filter to remove shadows, reorder page 3 and 4 via drag-and-drop, and instantly download a professional PDF.
5 Camera Photos of Paper1 Clean, Multi-Page PDFArchiving Expense Receipts
A business traveler uploads 10 separate photos of crumpled taxi and restaurant receipts. The tool enhances the contrast to make the faded ink legible and compiles them into a single PDF for HR.
10 Receipt JPEGs1 Optimized Expense PDFFrequently Asked Questions
Why does the browser ask for camera permission, and is video streamed anywhere?
How does the Black & White Document filter make gray paper backgrounds look crisp white?
Can I switch a page's filter from B&W back to Original color after capturing it?
What is the difference between A4, US Letter, and Fit page sizing for camera scans?
Can I upload existing photos of paper documents instead of using a live camera?
Key Features
- Direct HTML5 camera capture via navigator.mediaDevices.getUserMedia() targeting rear environment lenses at 1920x1080 Full HD
- Real-time ITU-R BT.601 luminance processing with three non-destructive filter modes: High-Contrast B&W Document, Grayscale, and Original Color
- Hybrid capture workflow combining live multi-shot camera scanning with gallery or desktop image uploads in a single document queue
- Per-page 90-degree rotation, instant filter toggling, deletion, and HTML5 drag-and-drop page reordering
- Client-side pdf-lib compilation outputting standardized A4, US Letter (with 20 pt margins), or zero-margin exact-fit PDF sheets
- Private local execution ensuring sensitive tax forms, receipts, identification cards, and signed contracts never touch external servers
Common Use Cases
- Digitizing stacks of thermal retail receipts and expense vouchers into high-contrast B&W PDFs before ink fades
- Scanning multi-page signed rental leases, NDAs, and tax returns directly from a phone browser without installing native apps
- Capturing handwritten whiteboard notes, lecture handouts, and textbook diagrams in Grayscale or Original color
- Photographing government IDs, passports, and insurance cards locally without risking cloud storage exposure
- Assembling mixed desktop webcam captures and mobile gallery photos into a unified US Letter or A4 submission packet
- Preparing clean, high-contrast paper scans ready for downstream OCR text extraction or digital signature placement
Explore More Tools in This Category
View All Developer & Utility ToolsCrop Image Online
Professionally crop your images online with precision controls, social media presets, and no quality loss. 100% secure client-side processing.
Rotate Image Online
Professionally rotate, straighten, and flip your images online with 0.1° precision. Features auto-expanding canvas, custom background colors, and secure client-side processing.
Flip Image Online
Mirror and flip your photos horizontally or vertically instantly. A free, client-side image flipper with no watermarks and 100% privacy.
Universal Image Converter
Seamlessly convert your photos and graphics between all major formats (JPG, PNG, WEBP, SVG) in seconds. 100% local, secure, and private.
Image Metadata Viewer
View hidden EXIF data, camera settings, GPS location, and privacy risks inside your photos securely in your browser.
Image Metadata Remover: EXIF Privacy Cleaner
Protect your privacy by permanently deleting GPS coordinates, camera models (EXIF), and hidden data from your photographs before sharing them online.
Color Picker From Image (Digital Eyedropper)
Identify and extract the exact HEX, RGB, and HSL codes from any photograph using our pixel-level precision magnifier.
Color Palette Generator From Image: AI Theme Extractor
Automatically extract dominant colors and cohesive brand palettes from any photograph or design inspiration using our advanced local clustering engine.