Pdf

From drn/dots · View interactive version

Pdf is an AI agent skill from the GitHub repository drn/dots. Use when the user wants to export conversation content, or an existing HTML file such as a saved Claude Artifact, to a professionally styled PDF for sharing

How to use this skill

Skill file

Export to PDF

Export summaries, research, or any content from the conversation to a professionally styled PDF for sharing. Also handles exporting an existing HTML file (for example, a saved Claude Artifact with inline SVG or custom CSS) directly to PDF.

Arguments

Instructions

You are exporting content from the current conversation to a shareable PDF document.

Step 1: Identify Content to Export

First determine the content type, then what to export:

  1. Markdown/conversation content (default): a summary, research, analysis, or other text from the conversation.
  1. Existing HTML file (for example, a saved Claude Artifact with inline SVG or custom CSS): the user names or points to an .html file already on disk instead of asking to export conversation text. md_to_pdf.py only parses Markdown and cannot render arbitrary HTML, CSS, or inline SVG. Skip Steps 2-4 and follow "HTML File Export" instead.

Step 2: Prepare the Content

(Markdown path only — for an existing HTML file, see "HTML File Export" below.)

Clean up the content for PDF export:

Step 3: Determine Filename and Title

Generate appropriate names:

Step 4: Generate PDF

Write the content to a temporary markdown file using a Bash heredoc (do NOT use the Write tool — it may be sandboxed to the workspace directory and reject /tmp paths), then convert to PDF:

# Write content to temp file — MUST use Bash heredoc, not the Write tool
cat << 'CONTENT_EOF' > /tmp/export_content.md
{markdown content here}
CONTENT_EOF

# Convert to PDF using the colocated script
python ~/.claude/skills/pdf/scripts/md_to_pdf.py \
  --input /tmp/export_content.md \
  --output {output_path}/{filename}.pdf \
  --title "{title}"

Determine {output_path} using the "Output Location" section below.

Important: Always use the Bash tool with cat << 'CONTENT_EOF' > /tmp/... for the temp file. The Write tool is sandboxed in some environments (e.g., Conductor workspaces) and will refuse paths outside the workspace.

Step 5: Confirm and Offer Options

After creating the PDF:

  1. Confirm the file was created with path and size
  2. Offer to reveal or share it, using the commands under "Output Location" below for the current environment

HTML File Export (Claude Artifacts, saved pages)

When exporting an existing HTML file instead of conversation markdown, skip md_to_pdf.py and render directly with weasyprint, a pure-Python HTML+CSS to PDF renderer that needs no browser. This is the only reliable path for HTML, CSS, or inline-SVG content — md_to_pdf.py (mistune + fpdf2) only understands Markdown.

# weasyprint is pure-Python and needs no browser, but depends on the
# cairo, pango, gdk-pixbuf, and glib system libraries (already present via
# Homebrew on most Mac development machines; install them first if missing)
pip3 install --quiet weasyprint

python3 -c "
import weasyprint
weasyprint.HTML(filename='{input_html_path}').write_pdf('{output_path}/{filename}.pdf')
"

Determine {output_path} using the "Output Location" section below, then confirm and offer options exactly as in Step 5.

Argus Worktree Sandbox Notes

Check whether the session is running inside an Argus worktree sandbox: $PWD under ~/.argus/worktrees/, or the ARGUS_TASK_ID environment variable set. Two things change in that environment:

Output Location

Usage Examples

Technical Notes

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.