artifact-to-pdf
Skill1 starsChanged 2 months agoMITView on GitHub
Save a Claude Artifact (or any HTML file) as a PDF with faithful CSS/layout. Use when the user wants to export, download, convert, or "save as PDF" an artifact, an HTML page, or a claude.ai/code/artifact URL, or asks the cleanest way to turn HTML into a PDF.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- yheshamx/artifact-to-pdftheir own version, first seen Aug 1, 2026
- davidgrahamsites/Claude-Skillstheir own version, first seen Jul 19, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- yheshamx/artifact-to-pdf★ 4same name
- davidgrahamsites/Claude-Skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository7 other files it gives its agents.
- character-sheet-gateSkill
- chill-dudeSkill
- code-rendered-videoSkill
- coding-cli-brief-loopSkill
- deploy-and-verifySkill
- emojliSkill
- minimizeSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 44
Verify success: first 8 bytes are %PDF-1.4 and file size is non-trivial.
- Distinctive: line 48
When you only have the artifact URL, drive the user's logged-in Chrome (browser tools), then convert.
- Very specific: line 71
If none is installed, weasyprint file.html out.pdf or wkhtmltopdf file.html out.pdf work but render some modern CSS less faithfully than …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Artifact → PDF
Convert a Claude Artifact or standalone HTML file to a PDF that preserves the original CSS/layout, by rendering through Chrome's own engine.
First: is the HTML already on disk?
The whole task hinges on getting the artifact's HTML onto the filesystem. Ask/check before doing anything else.
- User has the .html file (or pastes the HTML) → go straight to Convert.
- Only a
claude.ai/code/artifact/…URL → the content is login-gated and loads client-side, socurlreturns only the SPA shell and headless Chrome can't authenticate. Get the HTML first via Get HTML from a login-gated artifact.
Quick start (recommend this to a person)
The cleanest path for a human needs no tools:
Open the artifact → Cmd+P (Print) → Destination: Save as PDF → Save.
It uses the browser's own renderer, so layout is exact. Only reach for the scripted path below when the user wants it hands-free/automated, or when you must produce the PDF.
Convert (HTML on disk → PDF)
One headless-Chrome command, no dialog. Use the bundled script:
~/.claude/skills/artifact-to-pdf/scripts/html2pdf.sh "/path/to/artifact.html" "/path/to/out.pdf"Or inline:
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" \
--headless --disable-gpu --no-pdf-header-footer \
--print-to-pdf="out.pdf" "file:///abs/path/to/artifact.html"Notes:
file://needs an absolute path; spaces in the path are fine when quoted.--no-pdf-header-footerremoves the URL/date margins. Drop it if the user wants them.- Verify success: first 8 bytes are
%PDF-1.4and file size is non-trivial.
Get HTML from a login-gated artifact
When you only have the artifact URL, drive the user's logged-in Chrome (browser tools), then convert. Steps:
tabs_context_mcp{createIfEmpty:true}, thennavigatethe tab to the artifact URL.- The artifact renders in a cross-origin iframe (
<uuid>.frame.claudeusercontent.com) — you can't read it same-origin, and itssrccarries an auth token. Instead, navigate the tab itself to the frame URL so the artifact becomes the top document:
(After this,window.location.href = document.querySelector('iframe').src; 'navigating';location.pathnameis/code/frame/<uuid>— still underclaude.ai, now same-origin and readable.) - Trigger a download of the rendered HTML from inside the page (the base64/text channel back through the browser tool is blocked, so a Blob download is the reliable move):
const h = '<!doctype html>\n' + document.documentElement.outerHTML; const a = document.createElement('a'); a.href = URL.createObjectURL(new Blob([h], {type:'text/html'})); a.download = 'artifact.html'; document.body.appendChild(a); a.click(); a.remove(); - The download may need the user's confirmation. Find the saved file (
~/Downloadsor~/Desktop), then run Convert on it.
Simplest alternative to steps 2–4: tell the user to use the artifact's own ⋯ menu → Download as HTML, then hand you the file.
Non-Mac / no Chrome
- Chrome/Chromium/Brave all accept the same
--headless --print-to-pdfflags (swap the binary path). - If none is installed,
weasyprint file.html out.pdforwkhtmltopdf file.html out.pdfwork but render some modern CSS less faithfully than Chrome.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

