ANTIGRAVITY LABJP
Articles/Editor View
Editor View/2026-06-16Intermediate

Feeding Spec PDFs to Antigravity 2.1.4: A Practical Attachment Workflow

Field notes on using the PDF attachment added in Antigravity 2.1.4 as a spec-driven implementation workflow: supported formats, the scanned-PDF trap, token cost, and how to verify the output.

Antigravity238PDFEditor4Spec-drivenWorkflow6

Premium Article

The night I noticed the payment provider only shipped its REST reference as a PDF, I was rebuilding the billing layer of an app I run as an indie developer.

The endpoint list, the request body types, the error-code table — all of it lived inside tables in a PDF, and I was retyping it line by line into the chat box. One slip in the transcription, and the agent would generate a client using a field name that does not exist.

Once Antigravity 2.1.4 let me attach the PDF directly, that retyping disappeared. But you cannot just throw any file at it and expect a clever read. After a few days, the ways of handing over a PDF that work and the ways that don't separated cleanly, so here is where I draw the line.

Which PDFs the attachment actually handles

The short version: attachment only works for PDFs that carry a text layer.

PDFs come in two broad kinds. In one, the characters are embedded as text data. In the other, a page was scanned from paper and the content is just an image. The agent reads the first kind directly. The second is, from the agent's point of view, a single picture — it cannot make out the table rules or the numbers.

A PDF exported from official API docs, an OpenAPI printout, a spec sheet from a design tool — these almost always carry a text layer. Old internal documents scanned from paper, or a procedure doc that is really pasted screenshots, are often image PDFs, and attaching them rarely gives the accuracy you hoped for.

Before attaching, you can confirm which kind it is with a single command.

# Check whether a text layer exists.
# Uses pdftotext, included in poppler-utils.
pdftotext spec.pdf - | head -c 400
 
# If nothing comes out, or only a scatter of symbols, it's an image PDF
# -> attaching it as-is won't be readable; you'll need OCR.

If even a few hundred characters of clean text come back, attach it as-is. If it's empty, run the OCR step below or hunt down the source data (an HTML or text version), which is usually faster.

The basic attachment flow

The operation itself is simple. Drag the PDF onto the chat input, or pick it from the attach icon. You can attach several at once.

After attaching, always tell the agent which part of the PDF to look at. Skip this and the agent tries to take in the whole document, returning answers pulled off course by unrelated pages.

Refer to the attached payment-api.pdf.
Target only the "Create Charge" endpoint on pages 14-18,
and write the request body type as a TypeScript interface.
Do not add fields that are not written in the PDF.

That last sentence — do not add unwritten fields — goes into nearly every prompt of mine. A type that drops a field from a spec becomes a defect as written, so I'd rather shut down the agent's well-meaning autocompletion.

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
When PDF attachment actually beats copy-pasting text, and the exact conditions where it does
A one-command check with pdftotext to spot scanned image PDFs and avoid wasted tokens
A Python script to split a 100+ page spec into sections, with notes on the measured difference
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Antigravity Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

Related Articles

Editor View2026-04-08
Antigravity Editor Common Errors Fix: AI Completion, Connection Issues & Project Loading Failures
Fix the most common Antigravity editor issues: AI code completion stopping, projects failing to open, terminal freezes, Git integration problems, and extension conflicts — with step-by-step solutions.
Editor View2026-03-24
The Complete Guide to Antigravity's Diff View — Reviewing and Managing AI Code Changes with Confidence
Learn how to use Antigravity's Diff View to efficiently review, approve, and manage AI-suggested code changes — chunk by chunk, file by file.
Editor View2026-05-24
VS Code 1.121 and the Agent Host Protocol — Reading the Moment When Editor Boundaries Started Moving Outward
VS Code 1.121 introduced Remote agents and the Agent Host Protocol (AHP), expanded the Claude Agent's Auto mode and BYOK options, and made Markdown Mermaid support standard. Read from an Antigravity user's perspective, this release looks like the moment the editor began stepping outside itself.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →