3 This script will export all books in your preferred format (PDF, HTML, Markdown or TXT).
7 You will need php (~7.1+) installed on the machine you want to run this script on.
8 You will also need BookStack API credentials (TOKEN_ID & TOKEN_SECRET) at the ready.
13 # Downloading the script
14 curl https://raw.githubusercontent.com/BookStackApp/api-scripts/main/php-export-all-books/export-books.php > export-books.php
17 # ALTERNATIVELY: Open the script and edit the variables at the top.
18 export BS_URL=https://bookstack.example.com # Set to be your BookStack base URL
19 export BS_TOKEN_ID=abc123 # Set to be your API token_id
20 export BS_TOKEN_SECRET=123abc # Set to be your API token_secret
23 php export-books.php <format> <output_dir>
29 # Export as plaintext to an existing "out" directory
30 php export-books.php plaintext ./out
32 # Export as pdf to the current directory
33 php export-books.php pdf ./
35 # Export as HTML to an existing "html" directory
36 php export-books.php html ./html
38 # Export as Markdown to an existing "md-files" directory
39 php export-books.php markdown ./md-files