Skip to content

A semi-easy way to create a printable A4 PDF from documentation sites like Docusaurus or Notion. Useful for graduation projects.

Notifications You must be signed in to change notification settings

didier/docs-pdf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docs to PDF

Get started

  1. Create a .env file and fill it with your data. Refer to .env.example for more info.
  2. Make sure you using Node v14 — A bug in Puppeteer on Node 16 prevents this script from working. If you use nvm, You can run nvm use to switch to the correct version.
  3. npm run pdf
  4. ???
  5. Profit

Note: as of now, the program doesn't log anything to your console. If you want a more verbose output, run node index.js

Example Next-page Selectors

Make sure all your pages contain a 'next' link. Tools like Docusaurus and GitBook do this by default, but you'll have to do that manually for Notion.

  • Docusaurus
    NEXT_PAGE_SELECTOR=".pagination-nav__link.pagination-nav__link--next"
  • Notion (provided that you've added a 'next' link to each page)
    NEXT_PAGE_SELECTOR='.notion-page-content div a:last-of-type[href^="/"]:not([href*="#"])'
  • GitBook (causes a timeout for some reason, so broken for now)
    NEXT_PAGE_SELECTOR='[data-testid="page.desktopTableOfContents"] + div a:last-child[href^="/"]'

About

A semi-easy way to create a printable A4 PDF from documentation sites like Docusaurus or Notion. Useful for graduation projects.

Topics

Resources

Stars

Watchers

Forks