ব্লগ

PDF-এ vector vs raster barcode: অদৃশ্য chargeback

Acrobat-এ perfect দেখা barcode warehouse scanner-এ fail করতে পারে। কেন হয়, কত খরচ হয়, এবং তিন মিনিটে PDF verify করার উপায়.

Office printer-এ crisp ছাপা barcode এবং office test-এ clean scan করা barcode 5,000 miles দূরের 3PL thermal printer-এ fail করতে পারে, আর কোনো test environment-এ আপনি সেই failure mode দেখবেন না। Bug CI-তে ধরা পড়ে না, Adobe Acrobat-এ QA fail করে না, 4K monitor-এ নিখুঁত দেখায়। তবু supply-chain team-এর খরচ হয়: Amazon FBA inbound-এ প্রতি unit 0.25 USD, Walmart-এ non-compliant carton প্রতি 5-10 USD, কখনো receiving dock-এ পুরো pallet refused। Bug হলো PDF-এ barcode আসলে barcode-এর ছবি, barcode drawing instructions নয়। Print pipeline-এ picture resize হতে হতে bar widths scanner-এর প্রয়োজনীয় precision হারায়।

এই article তিন audience-এর জন্য। যে কেউ প্রথম section পড়ে বুঝতে পারবেন risk কোথায় এবং PDF vendor-কে কী প্রশ্ন করবেন। QA ও operations leads দ্বিতীয় section-এ print-quality grade কীভাবে collapse করে তা দেখবেন। Engineers তৃতীয় section-এ PDF-এর ভেতরে কী থাকে এবং তিন মিনিটে যেকোনো file verify করার উপায় পাবেন। প্রতিটি layer একটি clean takeaway দিয়ে শেষ হয়, তাই প্রয়োজনীয় অংশ পেলে সেখানেই থামতে পারেন।

এক table-এ

Question Barcode যদি drawing instructions হয় (vector) Barcode যদি picture হয় (raster PNG)
PDF-এর size ~1 KB ~50-300 KB
যেকোনো printer-এর resize survive করে হ্যাঁ; printer math থেকে redraw করে না; প্রতিটি resize sharpness কমায়
ISO 15416 print-quality grade A থাকে Production-এ A থেকে C/D-তে নামে
Walmart SSCC-18 chargeback risk Low High
Amazon FBA 0.25 USD-per-unit relabel Rare Bad template-এ routine
Switch করার effort Paths emit করে এমন renderer বাছুন Engineering project

আপনার team যদি scan-এ শেষ হওয়া কোনো workflow-এর জন্য PDF generation service evaluate করে, সবচেয়ে diagnostic প্রশ্নটি এই table-এর মূল সারি: এটি drawing instructions produce করে, নাকি picture? বাকি article সেই প্রশ্নের long version।

সবার জন্য: আসলে কী ঘটে, এবং cost কোথায়

Story 1 — Walmart pallet যেটা কেউ পড়তে পারেনি

এক supplier-এর product manager নতুন shipping-label template approve করেন। Adobe Acrobat-এ দারুণ দেখায়। Office printer-এ ঠিক ছাপে। প্রথম load, ৫০ pallet, ২০০ carton, Walmart distribution centre-এ যায়।

Receiving dock-এ lumper team (contracted unloaders) প্রতিটি pallet-এর SSCC-18 scan করে। SSCC-18 হলো 18-digit serial number, যা physical pallet-কে uniquely identify করে। ৫০ pallet-এর মধ্যে ৩টি first বা second scan pass-এ পড়া যায় না। Lumper team receiving lead-কে escalate করে। Lead EDI 856 ASN খুলে দেখে: supplier আগেই যে electronic manifest পাঠিয়েছে, তাতে এই load-এ থাকা সব SSCC listed। WMS বুঝতে পারে manifest-এর তিনটি SSCC physically present, কিন্তু unreadable। সেটাই discrepancy।

এর পর যা ঘটে তা dramatic নয়; procedural। Supplier-কে load flag করে EDI 824 application advice যায়। Receiving human-readable text থেকে unreadable SSCC manually key করে। Load receiving slot miss করে। “Labelling violation” হিসেবে compliance chargeback supplier account-এ পড়ে: 2026 সালে major retailers সাধারণত non-compliant carton প্রতি 5-10 USD নেয়, কখনো pallet per charge করে। এই load-এ direct cost 30-60 USD, একরকম rounding error।

আসল cost পরে আসে। Repeated labelling violations supplier-কে buyer review status-এ ঠেলে দেয়, future PO tighter compliance audit দিয়ে ধীর হয় এবং less-favoured routing tier-এ যায়। Quarter-এ হাতে গোনা bad pallet এটা করে না; misconfigured PDF stack থেকে systematic problem করলে করে, কারণ same template প্রতিটি load-এ ship করে।

Supplier-এর engineering post-mortem প্রায়ই weeks নেয়, কারণ team “PDF-এর ভেতরে barcode” কে meaningful internal structure হিসেবে ভাবে না। তারা ভাবেই, এটা শুধু barcode। Discovery, যে PDF-এ 300 dpi PNG bitmap ছিল এবং DC-এর thermal printer সেটিকে 203 dpi-তে resample করতে গিয়ে bar widths tolerance-এর বাইরে smear করেছে, সাধারণত প্রথম chargeback summary গভীর investigation বাধ্য করার পর আসে।

Story 2 — Amazon FBA shipment-এর slow-bleed chargeback

এই case নীরব, বড়, এবং ধরতে কঠিন।

Fulfilled-by-Amazon seller একটি SKU-এর ৫০,০০০ units FBA inbound-এ পাঠায়। প্রতিটি unit-এর label-এ FNSKU barcode থাকে, Amazon-এর per-SKU identifier। Typical bad template-এ 2-5 % units FBA warehouse-এ unscannable barcode নিয়ে পৌঁছায়; inbound scan first attempt-এ পড়ার জন্য bars যথেষ্ট sharp থাকে না। Amazon shipment refuse করে না। Affected units manual relabelling-এ পাঠায় এবং seller-কে fixed fee charge করে। 2026 অনুযায়ী fee হলো প্রতি unit 0.25 USD

৫০K-unit shipment-এ 5 % failure rate হলে direct chargeback 625 USD। প্রতি মাসে এমন shipment হলে বছরে 7,500 USD pure waste; সেটাও শুধু explicit chargeback line। বড় hidden cost হলো relabelled units FBA receive হতে বেশি সময় নেয়, buy box-এর জন্য available হয় না, promotional traffic slip করে, এবং launch cycle-এর ভুল মুহূর্তে revenue dip করে।

Sellerরা প্রায়ই Amazon Seller Central-এর FBA inbound defect & reimbursement report ঘাঁটতে গিয়ে বিষয়টি বুঝতে পারে। তার আগে line item “Amazon weirdness” হিসেবে write off হয়। Actual root cause, 300 dpi PNG emit করা barcode generator, months upstream এবং chargeback report-এর সঙ্গে খুব কমই কেউ connect করে, যদি না সে আগে এমন investigation করে থাকে।

Story 3 — UPS / FedEx carrier exception line

তৃতীয় case-এ direct chargeback নেই, তাই এটি সবচেয়ে invisible।

Parcel UPS বা FedEx sorting facility-তে ঢুকলে conveyor scanner milliseconds-এর মধ্যে carrier tracking barcode পড়ে। Read fail করলে, যেমন bars tolerance ছাড়িয়ে smeared, quiet zone cropped, modulation grade D, parcel reject হয় না। এটি main belt থেকে সরিয়ে exception-handling line-এ যায়, যেখানে একজন human-readable text থেকে tracking number type করে। Parcel 12-24 hour delay নিয়ে network-এ ফেরে।

Carriers সাধারণত এর জন্য direct chargeback করে না। Cost অন্য জায়গায় surface করে:

  • Customer service ticket বাড়ে: “আপনারা বলেছিলেন ship হয়েছে, এখন কোথায়?”
  • সত্যিই on-time shipment manual route-এ যাওয়ায় customer NPS কমে।
  • Carrier account audit সময়ের সঙ্গে supplier-কে labelling concern হিসেবে flag করে। Future pickup বেশি scrutinised হয়, contract renewal কঠিন হয়, rate negotiation খারাপ হয়।

একটি bad parcel measurable cost নয়। এক বছর ধরে মাসে ১০,০০০ bad parcel relationship-এর cost।

তিন গল্পের common thread

প্রতিটি গল্পে bug data, design, printer, বা scanner-এ নয়। Upstream এক choice-এ: barcode printer-এ পৌঁছেছে picture হিসেবে, drawing instructions হিসেবে নয়। Unfamiliar printer-এর জন্য resize হলে picture টেকে না। Drawing instructions টিকে।

কেন এটি এত common

Isolated অবস্থায় vector barcode produce করা কঠিন নয়; modern barcode libraries precise SVG output দিতে পারে। কঠিন অংশ হলো সেই vector barcode-কে embedded image না করে native PDF path operators হিসেবে PDF-এ বসানো। SVG paths-কে PDF path operators-এ translate করতে PDF generator এবং barcode engine co-designed হতে হয়। Shortcut হলো barcode library call করা, PNG output নেওয়া, তারপর PNG-কে Image XObject হিসেবে embed করা। Framework level-এ wire up করা অস্বাভাবিকভাবে সহজ, তাই বেশিরভাগ PDF stack সেটাই করে। Warehouse-এর দৃষ্টিতে, সেই এক architectural shortcut-ই thermal printer-এ পৌঁছে chargeback আনে।

এটাই layperson takeaway। এখানে থামলে যেকোনো PDF vendor-কে সঠিক প্রশ্ন করার এবং engineering team-কে article-এর শেষে থাকা তিন মিনিটের verification চালাতে বলার জন্য যথেষ্ট জানেন।

QA ও ops leads-এর জন্য: grade কীভাবে collapse করে

আপনার warehouse scanner যে standards আগে থেকেই ব্যবহার করে

Receiving dock-এ “ভালো barcode” বলতে কী বোঝায়, তা দুই ISO standard define করে:

  • ISO/IEC 15416 — 1D linear codes-এর জন্য: Code 128, GS1-128, ITF-14, EAN, UPC।
  • ISO/IEC 15415 — 2D matrix codes-এর জন্য: QR, DataMatrix, PDF417, Aztec।

Laboratory verifier printed symbol-এর সাতটি parameter মাপে এবং A (4.0) থেকে F (0.0) পর্যন্ত একটি overall grade দেয়। ANSI scale একই জিনিসের letter form। Walmart, Amazon, Target, Costco এবং major carriers-এর vendor manuals এই standards reference করে এবং সাধারণত grade C or better চায়। C-এর নিচে out-of-spec; D-এর নিচে উপরে বলা chargeback machinery trigger হয়।

সাত parameter এবং raster barcode প্রতিটিকে কীভাবে ক্ষতি করে:

Parameter Verifier কী check করে Raster PNG কেন ক্ষতি করে
Decodability Bar widths spec tolerance-এর মধ্যে আছে কি? Resampling widths off-spec করে; সাধারণত এটাই আগে নামে
Edge contrast Bar/space transition sharp কি? Resize-এর anti-aliasing grey transition pixels বানায়
Modulation Symbol জুড়ে light/dark contrast uniform কি? Print-driver dithering solid bars-কে dot pattern বানায়
Defects Spurious specks বা voids আছে? Resample artefacts label-এ real ink dots হয়
Min reflectance Bars যথেষ্ট dark কি? Resampling narrow bars-এর ভেতরে voids রেখে যেতে পারে
Symbol contrast Overall bar-vs-background contrast কেমন? Lossy PDF compression contrast flatten করে
Quiet zone Symbol-এর চারপাশে required white margin আছে? Auto-cropping tools margin খেয়ে ফেলে

Vector barcode প্রতিটি parameter A-এর কাছাকাছি রাখে, কারণ resample করার source pixel grid নেই। Raster barcode সাধারণত parameter প্রতি অর্ধেক grade হারায়; পাঁচ-ছয়টি ক্ষতি stack করলে average C বা D-তে নামে। Data identical। Encoding identical। Screen-এ barcode identical। শুধু printed symbol আলাদা, আর verifier এবং warehouse scanner printed symbol-ই মাপে, Acrobat-এ QA team যা দেখে তা নয়।

Printers কেন damage বাড়ায়

PDF-এ embedded raster PNG “Print” click থেকে label বের হওয়া পর্যন্ত ছয় resampling stage পার করে। প্রতিটি প্রায় অর্ধেক grade খরচ করে।

  1. Viewer screen-এর জন্য rasterises করে। Acrobat বা PDF reader source PNG-কে monitor pixel grid-এ interpolate করে। দেখতে ঠিক, QA এখানেই fooled হয়।
  2. Print driver paper-এর জন্য rasterises করে। Driver source pixels-কে printer grid-এ fit করতে bilinear বা bicubic interpolation বেছে নেয়। Edge contrast collapse করে।
  3. Colour conversion। CMYK বা grayscale conversion pipeline আরেক resample apply করে, প্রায়ই halftone dithering সহ। Modulation collapse করে।
  4. “Fit to printable area।” Edge clipping এড়াতে অনেক driver default 99 % page scaling করে। Decodability fraction of a grade drift করে।
  5. PDF/A flattening। Archival-PDF conversion transparency থাকা region re-rasterise করতে পারে। আরও অর্ধেক grade gone।
  6. Thermal head smear। Ribbon এবং direct-thermal media heat-এর নিচে 2-4 mil smear করে। Vector renderers compensate করতে পারে; raster sources পারে না।

Costs stack করলে renderer থেকে grade A নিয়ে বের হওয়া barcode scanner-এ grade C-D হয়ে পৌঁছায়। Operational arithmetic এটাই। Vector path operators stage 2-4 পুরো skip করে, কারণ resample করার source pixel grid নেই; printer-এর নিজস্ব rasteriser mathematical specification থেকে native DPI-তে bars compute করে।

আপনি QA lead হলে action item হলো এক ISO 15416 verifier rental: সপ্তাহে 1-2K USD, Cognex, Keyence, REA VeriCube-এর মতো vendor। আপনার highest-volume retailer flow থেকে ৫০টি production labels sample করুন। Average grade B-এর নিচে হলে আপনার raster-barcode problem আছে।

Engineers-এর জন্য: PDF-এর ভেতরে আসলে কী আছে

Page-এ barcode বসার দুই উপায়

PDF visible object মূলত দুই ধরনের define করে:

  • Path — drawing operators-এর list (re rectangle, f fill, m/l move/line, S stroke) floating-point coordinates-এ। Printer-এর নিজস্ব rasteriser এগুলো device native resolution-এ evaluate করে।
  • Image XObject — pixels-এ width/height থাকা embedded bitmap, PNG / JPEG / raw stream হিসেবে encoded। Renderer-কে source pixel grid device pixel grid-এ map করতে হয়, এবং তা সবসময় resampling চায়।

Vector Code 128 with 60 bars content stream-এ ~60 re/f pairs produce করে, total 1 KB-এর নিচে। Float coordinates 0.001 mm পর্যন্ত accurate। Raster Code 128 একটি Do /Im0 operator produce করে, embedded PNG-র দিকে point করে, সাধারণত 300 dpi-তে 270 KB।

% Vector — what the renderer should produce
0 0 0.40 22 re f       % bar 1: 0.40mm wide, 22mm tall
0.99 0 0.40 22 re f    % bar 2 ...
1.97 0 0.40 22 re f    % ~60 lines like this, ~1 KB total

% Raster — what most stacks actually produce
348 0 0 84 0 0 cm      % scale a 348×84 pixel image to 92mm × 22mm
/Im0 Do                % insert the embedded PNG (~270 KB)

Vector original specification printer পর্যন্ত রাখে। Raster source DPI-তে bars freeze করে এবং downstream প্রতিটি printer-কে guess করতে বাধ্য করে।

৩ মিনিটে যেকোনো PDF verify করা

তিনটি check, poppler-utilsqpdf ছাড়া বিশেষ tool লাগে না; Linux/Mac/WSL-এ free।

1. 800 % zoom করুন। Vector barcode যেকোনো zoom-এ crisp থাকে। Raster dramatic pixelate করে; source pixels গোনা যায়। Fastest informal check।

2. Embedded images list করুন:

$ pdfimages -list shipping-label.pdf
page  num  type    width  height color comp bpc enc      object  x-ppi  size
─────────────────────────────────────────────────────────────────────────────
   1    0  image     348      84  gray    1   1 ccitt     8 0     300   270K

আপনার barcode-এর aspect ratio-এর সঙ্গে মেলে এমন row দেখলে, যেমন wide 1D code-এর জন্য 348 x 84 অথবা 2D-এর জন্য square, সেটি raster image। Vector barcode এই output-এ আসে না।

3. Content stream inspect করুন:

$ qpdf --qdf shipping-label.pdf - | grep -A2 -B2 ' re$'

Vector Code 128 with 60 bars dense re/f operators cluster produce করে। Barcode থাকার জায়গায় rectangle না থেকে একটি Do /Im0 operator দেখলে, সেটি raster image।

Pro-grade verifier (Cognex, Keyence, REA VeriCube) 5K USD+ এবং formal ISO 15416 report দেয়। বেশিরভাগ team chargeback investigation শুরু হওয়ার আগে সেখানে যায় না; উপরের তিনটি free check আপনাকে জানিয়ে দেয় problem-এর কোন পাশে আছেন।

gPdf কী করে

gPdf-এর barcode rendering আসে xBarcode থেকে, একই team-এর sister product। xBarcode একটি Rust barcode engine, fully self-developed, third-party library wrapper নয়, এবং gPdf renderer এটিকে directly call করে। Matrix ও linear symbologies, যেমন Code 128, GS1-128, QR, Data Matrix, PDF417, Aztec, ITF, EAN, UPC এবং supported 30+ formats-এর বেশিরভাগের জন্য xBarcode bar/cell pattern compute করে এবং gPdf PDF content stream-এ re/f rectangle operators হিসেবে float coordinates-এ emit করে। Intermediate PNG নেই, source DPI নেই, raster surface নেই।

দুটি consequence আলাদা করে বলার মতো:

  • Engine publicly verifiable। xBarcode independent free online tool হিসেবেও xbarcode.ai এ চলে। যে কেউ payload paste করে SVG / PNG / EPS download করতে পারে এবং gPdf কী produce করে ধরে নেওয়ার আগে path output inspect করতে পারে। এই path output-ই আপনার gPdf PDF-এ যায়। “আমরা vector barcodes emit করি” ধরনের claim-এর credibility check সাধারণত এখানেই টিকে বা ভাঙে।
  • Performance measurable। xBarcode single core-এ standard 1D code ~4 µs-এ generate করে (v1.5.4); published benchmarks অনুযায়ী fast_qr থেকে 6x faster এবং rxing থেকে 30x faster। gPdf-এর Cloudflare Workers runtime দিয়ে end-to-end এটি worldwide ~30 ms p50-তে translate হয়।

Path output ছাড়াও xBarcode GS1 layer handle করে, যেটি বেশিরভাগ third-party barcode library পুরোপুরি skip করে: 750+ Application Identifiers registry, strict / lenient validation modes, automatic FNC1 separator insertion, এবং per-AI length ও character-set checks। আপনার (01)09504000059101(17)260315 element string encoding-এর পরে নয়, encoding-এর আগে spec-এর against validate হয়।

PDF/A-1b through 4 construction অনুযায়ী compatible; flattener pass লাগে না। Determinism exact: একই DocumentRequest isolates ও releases জুড়ে byte-identical content streams produce করে।

Raster কখন acceptable হতে পারে

দুটি real case:

  • Internal-only documents যেগুলো reliably scan করতে হবে না। Raster matter করে না, যদিও vector-ও free।
  • Marketing কারণে artwork-এর মধ্যে locked photographic logo with barcode। Scan reliability তখন conscious technical debt, oversight নয়।

এর বাইরে, shipping labels, FNSKU labels, payslips, invoice line-item barcodes, voucher PDFs, ticket QR codes, retail trade-item labels, pharmaceutical serialisation — সবকিছুর জন্য vector-ই একমাত্র choice, যা downstream print-pipeline gamble ship করে না।

Bottom line

Scan-এ শেষ হওয়া workflow-এর জন্য PDF stack বাছাই করলে প্রশ্নটি “QR / Code 128 / GS1-128 support করে কি?” নয়। প্রশ্ন হলো:

Barcode চাইলে result drawing instructions, নাকি embedded picture?

উত্তর picture হলে আপনার scan-failure rate-এর একটি floor থাকবে, যা কোনো X-dimension calibration, font-substitution care, বা printer maintenance কমাতে পারবে না। Walmart chargebacks, Amazon 0.25 USD line items, carrier exception delays — এগুলো vendor problem বা warehouse problem নয়। এগুলো আপনার renderer থেকে বের হওয়া bytes-এর property।

আজকের সবচেয়ে সস্তা action হলো আপনার শেষ ১০০ outbound label PDFs-এ pdfimages -list চালানো। Barcode-shaped image object row কয়টি আসে গুনুন। সেই count-কে এমন এক unannounced compliance audit-এর size হিসেবে ধরুন, যা অপেক্ষা করছে।

See also

  • xBarcode — the engine, on its own — gPdf-এর barcode rendering xBarcode দিয়ে powered, একটি sister Rust engine যা independent free tool হিসেবে চলে। Payload paste করুন, SVG download করুন, path inspect করুন। একই engine, একই output, যা আপনার gPdf PDFs-এ লেখা হয়।
  • GS1-128 barcodes at 0.1 mm precision in JSON — raster failure mode সরানোর পর X-dimension story।
  • Shipping label PDFs at carrier-grade scale — 4x6 thermal-এ Code 128 carrier-tracking label-এর concrete request shape।
  • The full barcode reference — supported সব symbology, sizing field এবং human-readable interpretation line-এর barcode_text block।