SPShaishav Patelinultimatetools.hashnode.dev·May 12 · 6 min readMulti-Region Tax Logic in TypeScript — GST (India), HST by Province (Canada), VAT (UK), and EU Reverse Charge in One Invoice EngineThe Problem Building an invoice generator that works correctly for multiple regions means handling tax rules that differ not just by country, but by sub-region (Canadian provinces), transaction type (India domestic vs interstate), and B2B context (EU...00
SPShaishav Patelinultimatetools.hashnode.dev·May 12 · 4 min readReading and Writing PDF Metadata with pdf-lib — DocInfo Fields, Date Parsing, and the Keywords ArrayThe Document Information Dictionary Every PDF contains an optional document information dictionary with standard string fields. The PDF spec defines these as: Title — the document's title Author — the author Subject — a description of the content Ke...00
SPShaishav Patelinultimatetools.hashnode.dev·May 12 · 5 min readClient-Side PDF to JPEG with PDF.js — Canvas Render Loop, Scale Factor, and Dynamic ImportThe Core Problem Converting a PDF page to an image in the browser requires rendering the PDF onto a canvas, then exporting the canvas to JPEG or PNG. Three things matter: Bundle size — PDF.js is large (~1MB). Loading it eagerly bloats your main bund...00
SPShaishav Patelinultimatetools.hashnode.dev·May 12 · 5 min readRemoving Pages From a PDF with pdf-lib — Index Mapping, copyPages, and Client-Side State ManagementThe Core Problem Removing pages from a PDF with pdf-lib isn't a "delete" operation — it's a rebuild. You create a new document, copy only the pages you want to keep, and discard the rest. The tricky part: copyPages works with original indices from th...00
SPShaishav Patelinultimatetools.hashnode.dev·May 12 · 4 min readBuilding a Browser Image Format Converter — Canvas toDataURL, MIME Routing, and Transparent Background HandlingThe Core Problem Converting between image formats in the browser comes down to one function: canvas.toDataURL(mimeType, quality). But three things trip up a naive implementation: Transparent → JPEG — JPEG has no alpha channel. A transparent PNG conv...00