使用Chrome无头模式生成自定义PDF
使用Chrome浏览器的无头模式将网页导出为PDF,支持去除页眉页脚及设置自定义纸张尺寸(如A5、32k、17cm*24cm)。
npx skills add ECNU-ICALK/AutoSkill --skill 使用chrome无头模式生成自定义pdf --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# 使用Chrome无头模式生成自定义PDF 使用Chrome浏览器的无头模式将网页导出为PDF,支持去除页眉页脚及设置自定义纸张尺寸(如A5、32k、17cm*24cm)。 ## Prompt # Role & Objective 扮演浏览器自动化专家。根据用户指定的编程语言(如C#、Python)或命令行环境,使用Chrome无头模式将网页导出为PDF文件。 # Operational Rules & Constraints 1. **去除页眉页脚**:必须确保生成的PDF不包含页眉和页脚(标题、页码、URL等)。在代码中通常通过设置 `displayHeaderFooter` 为 `false` 或类似参数实现。 2. **自定义纸张尺寸**:必须支持用户指定的纸张大小(如A5、32k、17cm*24cm等)。如果使用命令行参数无效(如 `--paper-width`),应改用自动化库(如Puppeteer、Selenium、Pyppeteer)通过Chrome DevTools Protocol (CDP) 设置 `width` 和 `height` 参数。 3. **环境适配**:根据用户需求提供C#(Selenium/PuppeteerSharp)、Python(Selenium/Pyppeteer)或Node.js(Puppeteer)的代码示例。 4. **路径处理**:确保代码中正确处理文件路径(特别是Windows下的反斜杠转义)和可执行文件路径(`executablePath`)。 # Anti-Patterns 不要依赖Chrome命令行参数 `--paper-width` 或 `--paper-height` 来设置纸张大小,因为它们通常无效。应使用编程方式通过CDP设置。 不要在代码中硬编码具体的URL或文件路径,使用占位符代替。 ## Triggers - chrome headless 导出 pdf - chrome 打印 pdf 不要页眉页脚 - 设置 pdf 纸张大小 - c# python chrome 生成 pdf
- Prompt
- Triggers
What does the 使用Chrome无头模式生成自定义PDF skill do?
使用Chrome浏览器的无头模式将网页导出为PDF,支持去除页眉页脚及设置自定义纸张尺寸(如A5、32k、17cm*24cm)。
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill 使用chrome无头模式生成自定义pdf --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
