onepage-pdf
Convert an HTML page into a single continuous-page PDF (one tall page, no pagination breaks), preserving desktop layout, backgrounds and selectable text. Use when the user asks to turn an HTML file/report/proposal into a "single-page PDF", "long PDF", "不分页 PDF", "单页 PDF", "长图式 PDF", or complains that an HTML-to-PDF export breaks into pages or cuts content. Supports optional string redaction with leak verification.
- License 许可
- MIT
- 最近更新
- 2026-11-01
- Stars
- ★ 3
- Forks
- 1
01 前言 Front Matter
- name
- onepage-pdf
- description
- Convert an HTML page into a single continuous-page PDF (one tall page, no pagination breaks), preserving desktop layout, backgrounds and selectable text. Use when the user asks to turn an HTML file/report/proposal into a "single-page PDF", "long PDF", "不分页 PDF", "单页 PDF", "长图式 PDF", or complains that an HTML-to-PDF export breaks into pages or cuts content. Supports optional string redaction with leak verification.
02 资源文件 7
- 其他.gitignore27 B
- 其他examples/demo-fixes.css361 B
- 参考文档examples/demo.html5.1 KB
- 许可证LICENSE1.0 KB
- 参考文档README.md3.5 KB
- 参考文档references/mechanics.md7.0 KB
- 脚本scripts/onepage_pdf.py10.8 KB
03 SKILL.md 正文
onepage-pdf
Render HTML to one tall PDF page via headless Chrome, then crop the page to the real content height with PyMuPDF. Height is never predicted (print layout is not screen layout); it is measured after rendering, which is exact.
Requires: Python with pymupdf, plus a local Chrome or Edge.
Workflow
1. Inspect the source HTML first
Read the HTML and check four things; they decide whether --extra-css is needed:
- Responsive breakpoints. Print media queries evaluate against the default
paper width (~741px), NOT the
@pagesize. Any@media (max-width: N)with N ≥ 741 will fire during print and collapse the desktop layout. For each such rule, write an override locking the desktop value with!important(e.g..grid{grid-template-columns:repeat(3,1fr)!important}). - Glassmorphism.
backdrop-filterblur is silently dropped in PDF output. If glass elements sit on busy backgrounds, add a print fallback:.glass{backdrop-filter:none!important;background:rgba(255,255,255,.88)!important}. - Scroll-reveal animations. Common class patterns (
fade*,reveal*,animate*,aos) are forced visible automatically. Anything else that starts atopacity:0needs an explicitopacity:1!importantoverride. - vh/vw sizing. Viewport units resolve against the page area in print and
drift ~1%; a
min-height:100vhhero becomes ~187in tall on the bedrock page. Override such rules with fixed px values.
Put all overrides in one CSS file and pass it via --extra-css.
2. Convert
python scripts/onepage_pdf.py input.html -o output.pdf --width 1280 \
[--extra-css fixes.css] [--replace subs.json --forbid words.txt]
--width: match the design width of the page (snapped to 8px; non-8px page sizes hit MediaBox rounding bugs that spawn phantom pages).--replace: JSON[["old","new"], ...], applied in order — put longer / more specific strings first. Use for redaction before publishing.--forbid: one word per line; the script aborts if any survives in the HTML or in the final PDF text layer. Always pair with--replace.--crop pixel: switch to raster row-scanning if the vector crop misjudges (e.g. a decorative element painted taller than the real content).
The script self-handles: oversized-bedrock rendering with auto-retry on overflow, content cropping (MediaBox + CropBox rewritten identically for viewer compatibility), CJK-safe output paths, single-page assertion.
3. Verify
The script prints OK 1 page, WxHpt. Then:
- Render a thumbnail and eyeball it (layout intact, no collapsed grids,
backgrounds present, nothing cut at the bottom):
import pymupdf doc = pymupdf.open("output.pdf") doc[0].get_pixmap(dpi=40).save("check.png") - If redaction was used, the forbid check already ran against the PDF text; still spot-check the rendered image for sensitive content in raster form.
- Heed the script warnings: heights above 14400pt break Acrobat (Chrome, Firefox and WeChat preview are fine); "content nearly fills the bedrock" means inspect the tail for truncation.
Troubleshooting and mechanics
Read references/mechanics.md when output looks wrong (collapsed layout, missing backgrounds, blank page, phantom second page, blurry or missing CJK glyphs) — it documents the Chrome print-rendering rules this tool is built around, plus the CDP-based alternative route.
04 同仓库更多 Skills
seedance-prompt-en
Write effective prompts for Jimeng Seedance 2.0 multimodal AI video generation. Use when users want to create video prompts using text, images, videos, and audio inputs with the @ reference system. Covers camera movements, effects replication, video extension, editing, music beat-matching, e-commerce ads, short dramas, and educational content.
native-feel-cross-platform-desktop
Use when the user is designing, prototyping, or rewriting a desktop app that must run on multiple OSes (macOS + Windows, optionally Linux) AND feel indistinguishable from a native app to its users — fast launch, native windowing, native input handling, native materials. Trigger words include "cross-platform desktop", "Electron alternative", "Tauri vs native", "WebView wrapper", "near-native performance", "Raycast architecture", "WebKit/WebView2 quirks", "WKWebView", "system tray app", "global hotkey app", "launcher app". Do NOT trigger this skill for pure web apps, pure mobile apps, or for greenfield projects that have no native-feel requirement.
gstack
Router for the gstack skill suite. (gstack)
fireworks-tech-graph
Use when the user wants to create any technical diagram - architecture, data flow, flowchart, sequence, agent/memory, or concept map - and export as SVG+PNG. Trigger on: "画图" "帮我画" "生成图" "做个图" "架构图" "流程图" "可视化一下" "出图" "generate diagram" "draw diagram" "visualize" or any system/flow description the user wants illustrated.
dbs-video-extract
接收抖音、小红书、微信视频号等短视频链接或分享文案,查询作品/账号数据并提取语音文字稿,按作者和标题归档为 Markdown。用户希望完整解析短视频、取得数据或文字稿时使用;运行前检查 TikHub 与轻抖使用凭证,缺少时用新手能理解的方式引导购买和安全配置。
dbs-spread
用传播学与社会心理学中匹配当前内容的理论,解码共鸣机制、受众情绪、有效立场和传播动机。用户要求分析内容为什么能引起共鸣、打中什么情绪或受众还想听什么时使用。