Papermark to pdf
Skill yaniv-golan/papermark-to-pdf-skill/papermark-to-pdf/skills/papermark-to-pdf
Download a Papermark deck (papermark.com/view/... or papermark.io/view/...) as a PDF. Use when the user pastes a Papermark view link and wants it saved, downloaded, archived, exported, or converted to a PDF. Slides are lazy-loaded CloudFront images — curl/wget/HTML scraping won't work, so this skill drives a headless browser. Not for DocSend, pptx, existing PDFs, or uploading to Papermark.From its SKILL.md
npx -y skills add yaniv-golan/papermark-to-pdf-skill --skill papermark-to-pdfAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
6.4 KB, as published. Nobody here has run it
Papermark to PDF
Convert any Papermark shared deck URL into a high-quality PDF file.
How it works
Papermark renders decks as individually-signed CloudFront images that lazy-load one page at a time. You can't scrape the HTML or curl the image URLs — they're CORS-blocked and session-tied. This skill uses a bundled Playwright script that opens the deck in a headless browser, intercepts the CloudFront image responses as they arrive, navigates through every slide using keyboard/button input to trigger lazy loading, and compiles the images into a PDF.
When to use this skill
Whenever a user shares a papermark.com/view/ or papermark.io/view/ URL and wants a PDF version.
Workflow
Step 1: Extract the URL and output path
Pull the Papermark URL from the user's message (or from the argument if invoked via /papermark-to-pdf <url>). It will look like:
https://www.papermark.com/view/<document-id>
https://www.papermark.io/view/<document-id>
For the output path: use the second argument if provided. If omitted, the script automatically derives a filename from the deck's page title (e.g. Acme_Q3_Pitch.pdf). If no title is available, it falls back to deck.pdf. Always tell the user the final output path once the script prints it.
Step 2: Ensure dependencies are installed
Run this once per session if needed:
# Install Python packages only if missing
python -c "import playwright; from PIL import Image" 2>/dev/null \
|| pip install playwright Pillow --break-system-packages -q
# Install Playwright's Chromium unless a system Chromium is already configured
[ -n "$PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH" ] \
|| playwright install chromium 2>&1 | tail -1
Playwright + Chromium is ~110 MB on first install. If packages and browser are already present these commands return instantly. In container environments where Chromium is pre-installed, set PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH to its path — the script reads this variable and passes it to launch(), and the install step skips the download entirely.
Step 3: Run the conversion script
python "<skill-dir>/scripts/papermark_to_pdf.py" \
"<papermark-url>" \
["<output-path>.pdf"] \
[--debug]
Both output.pdf and --debug are optional. The script handles everything: opening the page, intercepting signed CloudFront image responses, navigating through all slides via keyboard (ArrowRight) with button-click fallback, and compiling images into a landscape PDF. It prints per-page capture progress and exits 0 on success.
--debug logs every CloudFront URL intercepted, not just page images. Use it when diagnosing 0-image captures or unexpected URL patterns.
Step 4: Report the result
Tell the user the file path, page count, and file size from the script's final output:
PDF saved: /path/to/deck.pdf (N pages, X.X MB)
The script also prints a verification line confirming whether the captured page count matches the deck's reported slide count. Flag any mismatch to the user.
Gotchas
These are hard-won lessons from building this skill. Each one is a dead end that looks promising but wastes time:
-
curl/wget won't work on the image URLs. CloudFront signed URLs reject requests from outside the browser session, even with correct Referer and User-Agent headers. You'll get a 110-byte XML "Access denied" response.
-
JavaScript fetch() from the page context fails too. The images are cross-origin (CloudFront), and the server doesn't send CORS headers.
fetch()throws, andno-corsmode returns opaque responses you can't read. -
Canvas toDataURL() is blocked. Drawing a cross-origin image to a canvas taints it.
toDataURL()returns a tiny blank image (98 chars of base64). SettingcrossOrigin = "anonymous"on a new Image causes a load error because the server doesn't support CORS. -
Scrolling doesn't trigger lazy loading. Papermark hides non-current slides with a CSS
hiddenclass on the parent container. IntersectionObserver never fires because the elements aredisplay:none, not off-screen. You must navigate through the slides using keyboard or button input. -
Position-based button detection is fragile. The script previously found the "next" button by checking
box["x"] > 1400. This breaks on any viewport change or layout tweak. The script now usesArrowRightkeyboard navigation first, with positional button-click as a fallback. -
jsPDF from CDN is blocked. Papermark's Content Security Policy blocks external script loading.
-
Each page has a unique CloudFront signature. You can't extract one page's signed URL and swap the page number. Each
/page-N.jpeghas its own cryptographic signature. The only way to get all signatures is to navigate to each page and let the viewer fetch them. -
Some slides are PNG, not JPEG. The format varies per slide. The script handles both automatically, converting RGBA/P-mode PNGs to RGB before PDF assembly.
-
The last "page" may be a Papermark promo slide. Papermark sometimes appends an account-creation page not part of the deck. The script captures only pages intercepted from CloudFront image responses, so promo slides served differently are naturally excluded.
Troubleshooting
- Timeout during navigation: Papermark may be slow or the URL may require authentication. Check that the link is publicly accessible (no email gate or password).
- 0 images captured: The page structure may have changed. Check if
img[alt^="Page"]still matches slide images, or if CloudFront URLs still contain/page-. Run with--debugto print every CloudFront URL intercepted and confirm the expected pattern. - Partial capture (fewer pages than expected): The script waits up to 2s per slide. For very slow connections, you can increase the
sleepvalues in the script. - Playwright install fails: Try
playwright install --with-deps chromiumto also install system dependencies.