यूज़ केस · लॉजिस्टिक्स और शिपिंग

Carrier-grade scale पर शिपिंग लेबल PDF

Vector GS1-128 barcodes, ITF-14 carton codes और SSCC-18 pallet IDs के साथ 4×6 thermal shipping labels render करें. Black Friday spikes में भी Edge rendering p99 को 15 ms से कम रखती है.

काम जो पूरा करना है

Order JSON से सीधे carrier-ready 4×6 thermal शिपिंग लेबल render करें, जिसमें vector GS1-128, ITF-14 और SSCC-18 barcodes शामिल हों. हर request पर headless browser चलाने की जरूरत न पड़े. Output Zebra, SATO और Honeywell printers पर 203 dpi में reliably scan हो और retail peak spikes में p99 15 ms से कम रहे.

इस use case में gPdf क्यों fit है

  • Vector Code 128, QR, DataMatrix, PDF417 और GS1-128 / ITF-14 / SSCC-18: 203 dpi, 300 dpi और 600 dpi पर sub-pixel accurate.
  • 0.1 mm coordinate precision: human-readable interpretation lines की overall length के लिए carrier tolerance meet करने में मदद करती है.
  • Page size `label_4_6_in`, साथ में `label_4_8_in` और `label_a6`, dominant thermal-printer formats के लिए pre-configured हैं.
  • Determinism: वही order JSON byte-identical PDF render करता है, इसलिए warehouse reprints कभी अलग label नहीं बनाते.
  • Edge rendering: carrier pickup से पहले same minute में 50,000 labels print हों तब भी p50 3 ms और p99 8 ms.
  • Stateless: label Cloudflare Worker isolate की memory में लगभग 4 ms रहता है और फिर free हो जाता है. कोई document store नहीं, carrier-data leakage surface नहीं.

Sample request

POST /api/v1/pdf/render — Code 128 carrier-tracking barcode वाला minimal 4×6 thermal label.

{
  "pages": [{
    "size": "label_4_6_in",
    "elements": [
      {
        "type": "text",
        "x": 4, "y": 6,
        "content": "SHIP TO",
        "style": { "font_size": 8, "font_family": "NotoSans-Regular" }
      },
      {
        "type": "text",
        "x": 4, "y": 12,
        "content": "Acme Distribution Centre\n1200 Logistics Pkwy\nMemphis TN 38116",
        "style": { "font_size": 11, "font_family": "NotoSans-Regular" }
      },
      {
        "type": "barcode",
        "format": "code128",
        "content": "1Z999AA10123456784",
        "x": 4, "y": 60,
        "width": 92, "height": 22,
        "barcode_text": { "enabled": true, "position": "bottom" }
      }
    ]
  }]
}

Compliance और conformance

  • GS1 General Specifications: module width (X-dimension), quiet zone और overall length 203 dpi पर GS1 Section 5.4 tolerances से match करते हैं.
  • Carrier mandates: UPS, FedEx, DHL और USPS rendered output को scannable मानते हैं; per-carrier post-processing की जरूरत नहीं.
  • Tax या audit कारणों से label PDF रखना हो तो `settings.profile = "pdfa-2b"` के जरिए PDF/A-2b archival उपलब्ध है.

शिपिंग लेबल workload, एक paragraph में

हर order एक PDF बनाता है, हर PDF thermal printer पर एक बार print होता है, और अगर render slow है तो failure mode “page धीरे load हुआ” नहीं होता. Failure यह होता है कि warehouse pickup आपकी label-rendering API के पीछे queue में फंस जाता है. Shipping ऐसा workload है जहां p99 latency मुख्य product metric है, deterministic output जरूरी है क्योंकि reprints routine हैं, और barcode quality pixels में नहीं बल्कि GS1 X-dimension tolerances में मापी जाती है. यही तय करता है कि scanners पहली pass में label पढ़ेंगे या नहीं.

Headless-browser-based PDF stacks इन तीनों को साथ में संभालने में संघर्ष करते हैं: spike में cold-start cost compound होती है, छोटे thermal labels पर raster barcodes degrade होते हैं, और Chromium versions के बीच font rasterisation drift करता है. इसलिए “byte-identical reprint” संभव नहीं रह जाता.

gPdf क्यों fit बैठता है

4×6 thermal label छोटा होता है (203 dpi पर 576 × 864 pixels), element count low होता है (text blocks + 1-2 barcodes + optional carrier logo), और volume high होता है. Mid-size 3PL रोज 50,000 से 5,00,000 labels render कर सकता है. gPdf इसी workload के लिए built है. Renderer:

  1. Layout को एक बार compile करता है: page coordinates, font cascades और barcode geometry request time पर resolve होते हैं, browser layout engine के जरिए नहीं.
  2. हर barcode को vectorise करता है: modules सीधे PDF stream में draw होते हैं, इसलिए 30 mm-wide GS1-128 203 dpi या 600 dpi पर clean read होता है. आपकी side पर DPI-aware rasterisation logic नहीं चाहिए.
  3. NotoSans CJK + Latin embed करता है: वही payload Chinese carrier-name सही render करता है, बिना render container पर fonts provision किए.

हमारे reference workload में p99 flat 8 ms रहता है: EU-WEST पर ऊपर वाले sample के 1,000 invocations. इससे फर्क नहीं पड़ता कि single isolate ने एक label render किया है या 10,000 labels.

Volume + cost math

Typical mid-size 3PL लगभग 50,000 labels/day, यानी करीब 15 लाख labels/month operate करता है. Basic plan (US5/month for 100K pages, US0.00005 per page overage) पर calculation है:

1.5M pages × $0.00005       = $75.00 in overage
+ Basic plan base            =   $5.00
─────────────────────────────────────
total                         = $80.00 / month

यही workload Puppeteer-on-Lambda पर typical Lambda concurrency settings में US$200-400/month range में जाता है, peak के दौरान cold-start tax जोड़ने से पहले.

Black Friday: एक worked example

Peak spike वही workload है जहां edge rendering की value सबसे साफ दिखती है. मान लें किसी retail customer का Black Friday के पहले घंटे में normal label volume 200% हो जाता है: 60 minutes में 100,000 labels, average 1,700 labels/minute और peak bursts 5,000 labels/minute. यह एक single Cloudflare Workers region pool में complete होता है, cold-start tax के बिना. वही workload अगर average traffic के हिसाब से sized Puppeteer warm pool पर चले, तो burst-spawned containers पर 1.5-2.5 s cold starts आते हैं, और warehouse pickup desk हर delay महसूस करता है.

आगे क्या देखें