SShortSingh.
Back to feed

Four undocumented pitfalls when parsing Adobe Illustrator files in the browser with pdf.js

0
·1 views

Modern Adobe Illustrator .ai files are essentially PDF containers, making browser-side rendering possible using pdf.js without reverse-engineering any proprietary format. However, a developer building ArtboardLab, a free browser-based tool, uncovered four silent failure modes not covered in official documentation. CJK text such as Korean, Japanese, and Chinese glyphs disappears without any error if the cMapUrl option is not configured, because pdf.js fetches Adobe CMap tables at runtime rather than bundling them. Similarly, missing standardFontDataUrl and wasmUrl settings cause non-embedded fonts and JPEG 2000 images to silently fail. Transparent PNG export is also broken in pdf.js v6, requiring a workaround that renders pages twice on white and black backgrounds to derive correct alpha values from pixel differences.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

ACH Return Codes R01–R85: What They Mean and How Developers Should Handle Them

When an ACH transaction fails, Nacha issues a specific return code explaining the exact reason for rejection, unlike generic card-payment declines. Codes R01 through R85 exist in the Nacha rulebook, with R01, R03, R04, and R10 accounting for roughly 70% of returns in most production systems. Because ACH operates on a delayed settlement model, a debit entry can be returned up to five business days after origination, requiring systems to decode the code and decide whether to retry or halt. Some codes, such as R01 for insufficient funds, are retryable after a few days, while others like R03 or R10 signal permanent issues such as invalid accounts or fraud claims that warrant immediate escalation. Developers managing payouts or recurring payments are advised to build webhook or batch-reconciliation logic that matches returns to originals via trace numbers and updates payout status atomically within Nacha's required response windows.

0
ProgrammingDEV Community ·

DSPy compiled programs silently resend up to 20 few-shot demos on every API call

DSPy, a framework that automates prompt optimization, attaches up to 20 few-shot demonstration examples per predictor module by default during its compilation step. These demos — including full reasoning traces — are converted into chat message pairs and prepended to every single inference call, not just the first. In a multi-module pipeline, this can mean 60 to 80 extra messages sent with each end-user request, adding significant and invisible token overhead. Developers are unaware of this cost because the demos are injected by the optimizer, not written in source code. The article advises explicitly setting lower demo budgets at compile time and auditing attached demos before deploying a compiled program to production.

0
ProgrammingDEV Community ·

Hacker Runs 31M Tests to Build Clothing That Defeats Facial Recognition

Former software engineer and security researcher Bill Swearingen launched noRecognition in 2022 to develop clothing capable of evading AI-powered facial-recognition cameras. After running 31 million pattern-performance tests, he identified geometric arrangements and color combinations that can reduce a camera system's detection confidence to below 10%. Swearingen partnered with a North Carolina textile mill to produce the designs as real garments, with the first collection — including hoodies, caps, and face masks — released in early 2024. A privacy-score calculator on the noRecognition website lets customers test how well a design would fool common facial-recognition APIs before purchasing. Beyond personal privacy, Swearingen hopes the visibility of anti-surveillance fashion will push governments to impose stricter regulations on facial-recognition deployments in public spaces.

0
ProgrammingDEV Community ·

Proxy test of 90 MCP agent trials finds client-side failures masked as model errors

A developer ran 90 structured trials across three MCP servers and two AI clients — Claude Code and Gemini CLI — using a proxy on the stdio pipe to log every frame. The suite covered filesystem, Playwright, and GitHub servers across 15 scripted tasks, yielding 87 successes and 3 failures, all from Gemini CLI. A key pre-run discovery found one client was silently failing tool calls internally before any data reached the server, making the issue appear as poor model reasoning rather than a client bug. Token costs varied sharply between clients on the same server: GitHub tasks cost Claude Code a median 1,698 call tokens versus 223 for Gemini CLI, largely because Claude Code received verbose metadata blocks with each response that Gemini CLI did not. The divergence was traced to the two clients negotiating different MCP protocol revisions, illustrating that per-call token costs depend on client behavior, not just the server.

Four undocumented pitfalls when parsing Adobe Illustrator files in the browser with pdf.js · ShortSingh