You will need php (~7.1+) installed on the machine you want to run this script on. You will also need BookStack API credentials (TOKEN_ID & TOKEN_SECRET) at the ready.
This has quickly been thrown together and is not an officially supported part of BookStack.
# Downloading the script
curl https://gist.githubusercontent.com/ssddanbrown/45acb913a7b873240b2d89781e74a7a4/raw/export-books.php > export-books.php
# Setup
# ALTERNATIVELY: Open the script and edit the variables at the top.
export BS_URL=https://bookstack.example.com # Set to be your BookStack base URL
export BS_TOKEN_ID=abc123 # Set to be your API token_id
export BS_TOKEN_SECRET=123abc # Set to be your API token_secret
# Running the script
php export-books.php <format> <output_dir>
# Examples
## Export as plaintext to an existing "out" directory
php export-books.php plaintext ./out
## Export as pdf to the current directory
php export-books.php pdf ./
## Export as HTML to an existing "html" directory
php export-books.php html ./html
I couldn't figure out how to use PHP. I kept getting errors. But with the help of CHATGPT i managed to get this powershell script that downloads all books as HTML. Unfortunately I wasn't able to encode it in a way where characters like "ÅÄÖ" is displayed correctly.