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)
Select any local PDF, optionally trim unneeded pages before encoding, monitor the +33.3% payload expansion against Vercel and AWS limits, and copy API JSON snippets.
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.
Drop any local file up to 100MB+ or type UTF-8 text on the left. No data leaves your browser.
Load real client-side verified payloads straight into the workbench above. Zero third-party trademarks.
Trim a bloated multi-page PDF down to just the pages your webhook needs before +33.33% Base64 expansion triggers an HTTP 413 rejection.
Serverless runtimes enforce strict synchronous request ceilings: Vercel Serverless Functions cap HTTP bodies at 4.5 MB (4,718,592 bytes), while AWS Lambda proxy integrations behind REST API Gateway reject bodies above 6 MB. Because Base64 maps every 3 binary bytes into 4 ASCII characters, any PDF larger than roughly 3.35 MB blows past a 4.5 MB limit once serialized inside JSON.
Rather than launching a desktop PDF editor to split pages manually, the Pre-Encode Slimming bar lets you pick exact page ranges such as 1-2 directly in the browser. Using pdf-lib, Base64Doc constructs a fresh minimal PDF containing only those selected pages and updates the projected encoded footprint in real time.
When even the trimmed pages stay red above 6 MB, the budget evaluator recommends switching from inline JSON Base64 to pre-signed object-storage uploads or multipart binary streams.
Encode massive architectural blueprints or scanned archives in 786 KB slices without freezing browser tabs or corrupting Base64 padding.
Calling window.btoa() on a huge binary string forces JavaScript engines to allocate a single contiguous UTF-16 string and often hits memory ceilings or stalls the UI thread for seconds. Naive chunking introduces another fatal flaw: slicing at power-of-two boundaries like 65,536 bytes (not divisible by 3) injects illegal = padding characters in the middle of the stream.
Base64Doc reads local File blobs in 786,432-byte segments—exactly 262,144 three-byte groups—inside a dedicated Web Worker. Every intermediate slice maps cleanly to 1,048,576 Base64 characters with zero padding until the very final tail block.
Instead of dumping 135 million characters into an editable textarea, the UI renders a 4,096-character head and tail preview while keeping the full buffer ready for one-click clipboard copy or streaming .txt file download.
Export raw RFC 4648 strings, data:application/pdf;base64 URIs, or ready-to-paste JavaScript, Python, Go, and Bash decoder blocks in one click.
Different consumers expect different wrappers. HTML embed fixtures and offline test cases require a full data:application/pdf;base64, prefix; legacy SMTP attachments expect RFC 2045 MIME line breaks every 76 characters; and REST API test suites need a compact single-line string wrapped inside a JSON key.
Toggle those options above the output panel without re-reading the disk file, or switch to the Developer Export tabs to copy verified JavaScript, Python, C#, Go, Bash, or PowerShell snippets calibrated to your active alphabet and padding settings.
Drag any .pdf file from disk into the dropzone or choose it locally; the encoder reads File.slice() ranges directly in memory with zero server transmission.
If a 40-page scan exceeds your serverless request limit, specify a page subset like 1-3 in the Pre-Encode Slimming bar so pdf-lib strips unneeded pages before Base64 conversion.
Inspect the exact post-expansion byte count against Vercel 4.5 MB, AWS REST 6 MB, and AWS HTTP 10 MB thresholds while toggling Raw RFC 4648, URL-Safe, MIME-76, or Data URI output.
Copy the full Base64 string, grab an API JSON request wrapper, or export a multi-megabyte .txt file via streaming Blob without freezing your browser DOM.
| Capability | Base64Doc Behavior | Engineering Notes |
|---|---|---|
| Worker Chunk Alignment | 786,432 bytes (3 x 256 KiB) | Exact multiple of 3 prevents mid-file = padding between streamed chunks. |
| Deterministic Size Ratio | ceil(bytes / 3) x 4 (+33.33%) | A 3.37 MiB raw PDF reaches ~4.50 MB before JSON field wrapping. |
| Pre-Encode Trimming | pdf-lib page subset extraction | Discards extraneous appendix pages locally before encoding bytes. |
| Textarea Virtualization | 4,096 head + 4,096 tail chars | Prevents DOM reflow crashes on 100 MB+ encoded PDF documents. |
| Gateway Alert Thresholds | 4.5 MB / 6 MB / 10 MB | Green, yellow, and red badges warn before HTTP 413 failures occur. |
Base64 expands binary bytes by 4/3 (+33.33%), turning a 3.6 MB PDF into roughly 4.8 MB before JSON keys are added. Trim unneeded pages with the built-in slimmer first so the encoded payload stays under 4.5 MB.
No, chunked encoding processes 786,432-byte blocks inside a Web Worker and virtualizes the preview to 4,096 head and tail characters. You can copy the complete payload or stream-save a .txt file without UI lag.
Every 3 binary bytes (24 bits) encode cleanly into 4 Base64 characters without = padding. Using 786,432-byte slices guarantees valid concatenated Base64 output across chunks.
No, omit 76-character line breaks for JSON API payloads because embedded CRLF characters add ~2.6% unnecessary overhead and break strict single-line token parsers. Reserve MIME-76 for raw .eml email bodies.
Yes, enable the Data URI prefix toggle or select the Data URI snippet tab below the output box to copy the RFC 2397 string with application/pdf.
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.