惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

AI
AI
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Google DeepMind News
Google DeepMind News
T
Tenable Blog
博客园_首页
S
Securelist
Spread Privacy
Spread Privacy
Google Online Security Blog
Google Online Security Blog
Forbes - Security
Forbes - Security
Engineering at Meta
Engineering at Meta
U
Unit 42
L
LINUX DO - 热门话题
量子位
T
Threat Research - Cisco Blogs
博客园 - 【当耐特】
C
Cyber Attacks, Cyber Crime and Cyber Security
K
Kaspersky official blog
MyScale Blog
MyScale Blog
P
Proofpoint News Feed
The Last Watchdog
The Last Watchdog
Google DeepMind News
Google DeepMind News
GbyAI
GbyAI
Martin Fowler
Martin Fowler
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Security Latest
Security Latest
Scott Helme
Scott Helme
V
Vulnerabilities – Threatpost
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
I
InfoQ
Know Your Adversary
Know Your Adversary
Cisco Talos Blog
Cisco Talos Blog
The Register - Security
The Register - Security
T
The Blog of Author Tim Ferriss
aimingoo的专栏
aimingoo的专栏
V2EX - 技术
V2EX - 技术
T
Tailwind CSS Blog
月光博客
月光博客
Recent Announcements
Recent Announcements
G
Google Developers Blog
F
Full Disclosure
W
WeLiveSecurity
宝玉的分享
宝玉的分享
腾讯CDC
G
GRAHAM CLULEY
Vercel News
Vercel News
Simon Willison's Weblog
Simon Willison's Weblog
美团技术团队
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Help Net Security
Help Net Security

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Tab-Strip Anchor Navigation(TSAN) — A New Technique for HTML Tab UI in PDF (No JavaScript, No Layers)
Sushil Kulka · 2026-05-13 · via DEV Community

You know that moment when you're building something and hit a wall that every reasonable part of your brain says should already be solved by now?

That was me, three weeks ago, staring at an HTML component with tabs.
Not some exotic, over-engineered UI. Just tabs. The kind every front-end dev builds on their lunch break. A nav strip at the top, panels below, click a tab and the content switches. Dead simple. Except I wasn't trying to render it in a browser. I wanted to render it in a PDF.

A little context: what is TreePress?

TreePress is a VS Code extension I'm building that exports any open file to a pixel-faithful, searchable PDF. The entire value proposition is that the output looks exactly like what you see in your editor — same syntax highlighting, same colour theme, same font, same layout. No compromises.

That means when someone opens a file like a styled HTML page or a documentation file that uses tab components, TreePress can't just flatten it. The tabs have to come through. The reader needs to be able to interact with them.

Easy enough, right? ... export the tabs into the PDF.
Turns out: no. Not easy at all.

The brutal reality of PDFs in 2026
I did what any developer does when they hit something unexpected: I googled it. Then I googled it more carefully. Then I read three spec docs I really didn't want to read.

Here's what I found: the PDF specification has no native tab primitive. Not in PDF 1.7. Not in PDF 2.0. Not in any version. Tabs, as a UI element, are not supported in this format.

There are three workarounds that developers have used over the years, and every single one of them has a deal-breaking problem for TreePress:

1. Acrobat JavaScript show/hide fields

You can wire up invisible button widgets as tab headers and toggle the visibility of form field groups. It works — inside Acrobat. But Chrome's built-in PDF viewer ignores Acrobat JavaScript entirely. Firefox support is partial. And even where it works, your tab content has to live inside PDF form fields, which can't hold arbitrary rendered code with syntax highlighting. Non-starter.

2. Optional Content Groups (OCGs)

PDF layers. Put each tab's content on its own layer, set all but the first to hidden by default. The viewer exposes a Layers panel; the user toggles from there. This is the most standards-compliant approach — OCGs have been in the spec since PDF 1.5.

But here's the catch: pdf-lib doesn't support creating OCGs. It's been an open issue in the library for years. Switching PDF libraries just for this feature would mean rewiring a significant chunk of TreePress's post-processing pipeline. A huge change for a feature that still exposes a Layers panel to the user rather than the actual tab UI.

3. Just flatten it

Pick the "default" tab, render that content, and forget the others exist. Simple. Fast. Also, completely wrong for a tool whose entire pitch is fidelity.

I was stuck. Genuinely stuck. The stuck where you close the laptop, make coffee, and stare at the wall for a bit.

The insight that changed everything
On that wall-staring coffee break, I started thinking about what PDFs can do rather than what they can't.

Strip away everything fancy, and every PDF viewer that has existed since the early 90s supports exactly two universal primitives:

Drawing. You can paint rectangles, lines, and text directly onto a page's content stream. These aren't annotations — they're baked into the page itself, visible everywhere, always.

GoTo link annotations. A rectangular hotspot on a page that, when clicked, jumps to a named destination elsewhere in the document. This has been in the spec since PDF 1.1. Chrome supports it. Firefox supports it. Safari supports it. Acrobat supports it. Every PDF reader you've ever used supports it.

And that's when it clicked: I don't need the PDF to understand tabs. I need the reader to feel like it's switching tabs.

What if tabs weren't a feature of a single page, but a navigation metaphor spread across pages?

TSAN: Tab-Strip Anchor Navigation
That's the core of what I ended up building. I called it TSAN — Tab-Strip Anchor Navigation — because naming things helps you think about them clearly.

The idea works like this:

Phase 1 — Detect.

Before rendering anything, TreePress scans the live Puppeteer page for tab patterns. ARIA role="tab" attributes, Bootstrap .nav-tabs, Material .mat-tab, custom data attributes — anything that looks like a tab gets detected and registered as { label, activatorSelector, panelSelector }.

Phase 2 — Capture.

For each tab, TreePress force-activates it (programmatically clicks the activator and waits for the render to settle), then injects a CSS padding reservation at the top equal to the height of the strip we'll paint later. Puppeteer prints that tab's content to its own mini-PDF. We record which pages belong to which tab in a registry.

Phase 3 — Assemble.

All the per-tab PDFs get merged into a single document in order. Now we have a regular multi-page PDF with pages 1–3 as "Tab A content", pages 4–6 as "Tab B content", and so on. The tabStartPages[] array stores the starting positions of each tab.

Phase 4 — Decorate. (This is the invention.)

Now TreePress walks every page of the assembled document and paints a tab strip on it using only those two universal primitives.
For the active tab (the one that owns the current page), it draws a filled pill and a coloured accent line beneath the label. For every other tab, it draws a plain label — and places a GoTo link annotation on top of it, pointing to the first page of that tab's content.

The result: every page has a persistent, drawn tab strip at the top. Clicking any non-active tab label jumps to the start of that tab's page range. The PDF has no JavaScript, no layers, no form fields. Just rectangles, text, and link annotations — things every viewer has understood since 1993.

What it actually looks like

Open the exported PDF on any reader — Chrome, Firefox, Safari, Acrobat, Google Drive, Document Viewer on Linux, whatever you have. You see:

A tab strip across the top of every page, styled to match the source UI
The current tab is visually highlighted with a pill and accent line
All other tabs are clickable, jumping instantly to their page range
The tab strip is rendered as drawn content, meaning it's always visible — no settings to toggle, no layers panel to find

It doesn't behave identically to a JavaScript tab switcher in a browser. It's more like a well-indexed book: you flip to a section, and everything on that section's pages tells you which section you're in. That's actually a more natural mental model for a PDF anyway.

Why this matters for TreePress

TreePress exists because every existing "code to PDF" tool treats code as plain text. They dump a monospace font onto the page and call it done. The whole point of TreePress is that the output should feel like you took a screenshot of VS Code and made it searchable and printable.

TSAN extends that philosophy to interactive UI. It doesn't fake tabs. It doesn't flatten them. It translates the tab experience into the PDF medium without requiring anything from the reader that isn't already there.

This is the kind of problem I find genuinely exciting: a constraint that appears to be a dead end and turns out to be a design opportunity. The PDF format isn't broken; it just doesn't think in terms of HTML widgets. TSAN is TreePress learning to speak PDF natively.

TreePress Converted Tab enabled HTML into PDF

The module is open

The tabStripRenderer.ts module that powers this is being published with the TreePress extension. If you're building anything that involves rendering HTML with tabs into PDF — documentation tools, report generators, anything — the approach is directly reusable.

The four-phase pipeline (detect → capture → assemble → decorate) works independently of the VS Code extension machinery. You need Puppeteer for phases 1 and 2, and pdf-lib for phases 3 and 4. That's it.

If you've ever hit this wall — "I need to get interactive HTML into a PDF, and everything I try is broken" — I hope this gives you a usable path forward.

The PDF format is older than most of the developers reading this. It's occasionally infuriating. But it's also remarkably consistent, and consistency is something you can build on.

TreePress is a VS Code extension — open it in the Marketplace under treepress.vscode-treepress. TSAN is part of the V2 release.

Found this useful? Drop a like or follow.