As a freelancer and Codecanyon author, I frequently publish apps, themes, and templates for sale. One key requirement on Codecanyon is to include offline documentation with your main source files. For this, Iβve always relied on Gitbookβitβs a fantastic tool!
Previously, Gitbook allowed users to download their repositories as PDFs, which made sharing documentation straightforward. Unfortunately, this feature has recently become a premium offering.
Faced with this challenge, I decided to create my own solution! π
I built a Node.js script that scrapes Gitbook URLs, retrieves all the content, and converts it into organized PDF and PNG files. Hereβs how it works: 1οΈβ£ Provide your Gitbook URL to the script. 2οΈβ£ Run the script to generate structured files. Each folder corresponds to a Gitbook section, containing:
- PDFs for each page.
- PNG snapshots of the pages.
π Example Output:
intro/
page1.png
page1.pdf
installing theme/
page1.png
page1.pdf
change colors/
page1.png
page1.pdf
This script is a game-changer for anyone needing offline Gitbook documentation! π
Iβve open-sourced the code on GitHub: π Gitbook Page to PDF/PNG Converter
Feel free to clone, use, and improve the script. Contributions are always welcome!
πβ¨ Step-by-Step Tutorial: Convert Gitbook to PDF Using Node.js Script