When to Use
Use this skill when:
- - User asks "let me see this website" or "show me this page"
- User requests a screenshot of a webpage
- User wants to view or save webpage content
- You need to send a webpage as a file to the user
This approach is better than screenshots because:
- - ✅ Maximum clarity and legibility (PDF preserves all formatting)
- ✅ Preserves text, links, and structure
- ✅ Compact file format
- ✅ Professional appearance
- ✅ Easy to save, print, or share
Workflow
Step 1: Navigate to the URL
Use the browser tool to open the webpage:
CODEBLOCK0
Wait for the page to fully load.
Step 2: Export to PDF
Use the browser tool's PDF export:
CODEBLOCK1
This returns a file path like: INLINECODE2
Step 3: Send the PDF File
Use the message tool to send the file directly to the user:
CODEBLOCK2
Step 4: Clean Up (Important!)
Delete the local PDF file immediately after sending to save space:
CODEBLOCK3
Or in one line:
CODEBLOCK4
Why This Workflow
| Aspect | Why |
|---|
| PDF format | Preserves layout, fonts, colors, and links perfectly |
| Browser tool |
Native PDF export ensures compatibility |
| Direct file send | User gets the file immediately, no compression artifacts |
| Cleanup step | Respects workspace storage and keeps things tidy |
Common Patterns
Pattern 1: User says "show me this website"
CODEBLOCK5
Pattern 2: User asks for a screenshot
CODEBLOCK6
Pattern 3: Multiple pages/links
If the user wants multiple webpages:
- - Repeat steps 1-4 for each URL
- Or export all to PDF in a batch script (see
scripts/batch-export.sh)
Error Handling
Page fails to load
CODEBLOCK7
PDF export fails
The browser might be in headless mode or network issue. Try:
CODEBLOCK8
File not accessible
Check the path returned by browser pdf. If it's a relative path, convert to absolute:
CODEBLOCK9
Tips
- - For long pages: PDF preserves entire page length, so large documents are still readable
- For dynamic content: Wait for dynamic content to load before exporting
- For mobile view: Use
browser resize 375 812 before PDF export if mobile view is needed - For specific sections: Export full PDF, user can crop or extract what they need
Related Skills
- -
browser — OpenClaw's native browser automation - INLINECODE8 — Fallback if PDF export isn't suitable (rarely needed)
Feedback & Updates
- - Star this skill: INLINECODE9
- Check for updates: INLINECODE10
何时使用
当用户出现以下情况时使用此技能:
- - 用户要求让我看看这个网站或给我展示这个页面
- 用户请求网页截图
- 用户想要查看或保存网页内容
- 你需要将网页作为文件发送给用户
此方法优于截图,因为:
- - ✅ 最大清晰度和可读性(PDF保留所有格式)
- ✅ 保留文本、链接和结构
- ✅ 紧凑的文件格式
- ✅ 专业外观
- ✅ 易于保存、打印或分享
工作流程
步骤1:导航至URL
使用browser工具打开网页:
browser action=navigate url=https://example.com
等待页面完全加载。
步骤2:导出为PDF
使用browser工具的PDF导出功能:
browser action=pdf
这将返回一个文件路径,例如:FILE:/home/user/.openclaw/media/browser/uuid.pdf
步骤3:发送PDF文件
使用message工具直接将文件发送给用户:
message action=send filePath=/path/to/file.pdf message=这是网页的PDF版本!
步骤4:清理(重要!)
发送后立即删除本地PDF文件以节省空间:
exec command=rm /path/to/file.pdf
或者一行完成:
exec command=rm /path/to/file.pdf && echo ✅ PDF已清理
为什么采用此工作流程
| 方面 | 原因 |
|---|
| PDF格式 | 完美保留布局、字体、颜色和链接 |
| 浏览器工具 |
原生PDF导出确保兼容性 |
| 直接文件发送 | 用户立即获取文件,无压缩伪影 |
| 清理步骤 | 尊重工作区存储,保持整洁 |
常见模式
模式1:用户说让我看看这个网站
- 1. browser navigate
- browser pdf
- message send filePath=<结果> message=这是网站的PDF版本
- exec rm <结果>
模式2:用户请求截图
- 1. browser navigate
- browser pdf(优于截图!)
- message send filePath=<结果> message=网页的PDF视图
- exec rm <结果>
模式3:多个页面/链接
如果用户想要多个网页:
- - 对每个URL重复步骤1-4
- 或者通过批处理脚本将所有页面导出为PDF(参见scripts/batch-export.sh)
错误处理
页面加载失败
browser wait --url /expected-path --timeout-ms 10000
PDF导出失败
浏览器可能处于无头模式或存在网络问题。尝试:
browser status
browser start(如果未运行)
browser navigate
文件无法访问
检查browser pdf返回的路径。如果是相对路径,转换为绝对路径:
exec command=realpath <路径>
提示
- - 对于长页面:PDF保留整个页面长度,大文档仍可读
- 对于动态内容:导出前等待动态内容加载完成
- 对于移动视图:如需移动视图,在PDF导出前使用browser resize 375 812
- 对于特定部分:导出完整PDF,用户可自行裁剪或提取所需内容
相关技能
- - browser — OpenClaw的原生浏览器自动化
- screenshot — 如果PDF导出不适用时的备选方案(很少需要)
反馈与更新
- - 收藏此技能:clawhub star web-to-pdf
- 检查更新:clawhub sync web-to-pdf