Add html-to-pdf-hires skill#246
Open
MMTTGL wants to merge 1 commit intovercel-labs:mainfrom
Open
Conversation
Pixel-perfect HTML→PDF converter via 3x DPR Puppeteer screenshots embedded full-bleed into a fresh A4 PDF. Use when vector PDF output looks blurry or the user asks to export a deck/presentation crisply. Source: https://github.com/MMTTGL/html-to-pdf-hires License: MIT
|
@MMTTGL is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the html-to-pdf-hires skill to
skills/.It converts an HTML file or URL into a pixel-perfect, high-DPI rasterized PDF by screenshotting each
.pageelement at configurable DPR (default 3x) via Puppeteer and embedding the PNGs full-bleed into a fresh A4 PDF. Triggers on phrases like "convert this HTML to PDF", "export this deck to PDF crisply", or "the PDF you made looks blurry".Also handles slide-style decks where only one slide is visible at a time (
--activate-class=<name>), custom selectors, formats, orientation, and DPR.Layout
Note on script language
AGENTS.mdrecommends bash scripts underscripts/. This skill is Node + Puppeteer (the whole point is headless Chrome control), so the script isscripts/convert.js. Other content-only skills in this repo (e.g.composition-patterns,react-native-skills) also depart from the bash convention, so I followed precedent. Happy to refactor if you'd prefer ascripts/run.shwrapper.Source
Mirrored from https://github.com/MMTTGL/html-to-pdf-hires (MIT, © Primarch Systems Inc.).
Test plan
cd skills/html-to-pdf-hires && npm installnode scripts/convert.js path/to/some.html out.pdfproduces a multi-page PDF (one page per.pageelement)--landscape,--format=Letter,--dpr=4,--selector=.slideall behave as documented--selector=.slide --activate-class=active --landscapecycles the active class and emits one page per slide