Shipping API JSON -> 2 Auto-Named PDFs + 180 deg Label Fix
- Input Payload
- Raw Shipping API JSON (4.8 KB)
- Verified Output
- waybill_label.pdf (4x6 in, 180 deg -> 0 deg) + commercial_invoice.pdf (A4, 2 pages)
Stop guessing why base64: invalid input happens: pinpoint the exact 1-based line, column, and Unicode code point of bad characters, or auto-clean dirty strings.
Drop any file, paste Base64, or press Ctrl/Cmd+V with clipboard files or raw API JSON
Runs inside a local Web Worker. Network tab stays at 0 file POST requests.
Paste any Base64 string, Data URI, Postman JSON, SOAP XML, HAR, or EML payload on the left.
Load real client-side verified payloads straight into the workbench above. Zero third-party trademarks.
Find the exact offending character inside a 50,000-character Base64 block instead of staring at blind "invalid input" errors.
Terminal tools and naive web decoders fail silently or emit unhelpful one-liners like "base64: invalid input" without telling you where the problem sits inside a multi-kilobyte log block. Invisible copy-paste artifacts—like zero-width spaces (U+200B), curly smart quotes from chat apps, or a stray hyphen inside a standard string—look identical to valid characters on screen.
Base64Doc scans characters deterministically and reports the exact 1-based line number, column number, character offset, and Unicode code point (U+XXXX) on the very first violation.
Strip known Data URI headers, JSON escapes, and whitespace transparently while refusing to mask real data truncation.
Permissive utilities that silently delete every non-[A-Za-z0-9+/=] character destroy binary payloads whenever real data was corrupted or truncated: deleting two stray UTF-8 letters shifts every downstream 6-bit boundary and turns the rest of a PDF into garbage.
Base64Doc restricts auto-cleaning strictly to known transport wrappers (data:*;base64, headers, matching outer quotes, JSON \/ slashes, whitespace, and missing trailing = padding), listing every repair step applied. Any remaining invalid character or len % 4 === 1 truncation stops decoding fast.
Detect illegal = padding buried in the middle of a stream caused by naively joining independently encoded chunks.
Concatenating independently Base64-encoded 64 KB chunks injects = or == mid-stream because 65,536 is not divisible by 3. The validator flags non-terminal = signs immediately so chunk-alignment bugs surface right away.
Insert any string throwing base64: invalid input, atob DOMException, or Python binascii.Error directly into the validator.
See transparently whether outer quotes, data:*;base64, headers, JSON \/ slashes, whitespace, or missing = padding caused the failure.
If illegal characters remain—such as invisible U+200B zero-width spaces, smart quotes, or mid-string = signs—Fail-Fast validation pinpoints the exact 1-based coordinate.
Once clean, confirm the real magic-byte file type or decoded text immediately and copy the sanitized Base64 string.
| Capability | Base64Doc Behavior | Engineering Notes |
|---|---|---|
| Error Coordinate Precision | Line, Column, Offset, U+XXXX | Catches invisible zero-width spaces (U+200B) and curly quotes instantly. |
| Modulo-4 Truncation Rule | len % 4 === 1 -> Impossible Base64 | No amount of = padding can rescue 1 leftover 6-bit character. |
| Safe Sanitizer Scope | Data URI, quotes, \/, whitespace, = | Never deletes arbitrary mid-stream letters that would corrupt binary offsets. |
| Mid-Stream Padding Audit | Rejects "=" before final 2 chars | Catches accidentally concatenated multi-chunk Base64 strings. |
| Post-Validation Check | 66 Magic Bytes + Charset Sniff | Confirms decoded bytes actually form a valid file or legible text. |
Common culprits include invisible zero-width spaces, JSON-escaped \/ slashes, data:*;base64, prefixes, unpadded URL-safe -/_ characters, or missing trailing = padding.
Yes, it scans every character and reports the exact 1-based line, column, zero-based offset, and Unicode code point (e.g. U+200B) on the first failure.
Mathematically, 1 Base64 character holds only 6 bits—not enough to reconstruct 1 whole 8-bit byte—so len % 4 === 1 proves real truncation or an extra stray symbol.
No, RFC 4648 allows = padding strictly in the final one or two positions of the entire encoded stream; mid-stream = indicates concatenated chunks or spliced logs.
No, valid Base64 syntax can still hold a truncated PDF or HTML 500 error page; Base64Doc follows syntax validation with 66 magic-byte checks to confirm file integrity.
Avoid Chrome data: URI truncation and memory leaks when rendering Base64 PDFs in JavaScript using Uint8Array, Blob URLs, and Web Workers.
Fix binascii.Error Incorrect padding and binary mode corruption when decoding Base64 PDFs, Excel sheets, and images in Python.
Diagnose why base64 -d, atob, or APIs fail with invalid input: data: prefixes, URL-Safe -/_ chars, JSON \/ escapes, whitespace, and missing =.
Understand the +33.3% Base64 expansion math, Data URI overhead, Vercel 4.5MB and AWS 6MB/10MB payload limits, and when to switch to binary uploads.
Eliminate garbled characters (mojibake) when decoding Korean EUC-KR/CP949, Japanese Shift_JIS, Chinese GB18030, or Cyrillic Base64 payloads.
Cross-platform cheat sheet comparing GNU/Linux base64 -d -w0, macOS BSD base64 -D -i/-o, and Windows PowerShell [Convert]::FromBase64String.
Diagnose why decoded Base64 to PDF files open blank, corrupted, or upside down: 2MB Data URI caps, JSON \/ escapes, HTML 502 payloads, and text writes.
Convert Base64 columns in Excel without add-ins using Power Query Binary.FromText, Office Scripts, or VBA MSXML2, and avoid 32,767 cell truncation.