This is a Flask app that takes uploaded .doc, .docx, .odt, and .pdf files, converts them to .pdf, allows the user to arrange and rename them, optionally include page numbers and a table of contents (including embedded PDF bookmarks) and then merges them into one big file.
Go to https://spiffindustries.com/pdfpublisher/ to try it!
This app was inspired by my father, who was occasionally asking me to take stories that he had written using Microsoft Word and render a full-length .pdf file to submit to Staples for publishing as a hard-cover book. This is an effort to allow him to do it himself without waiting for me to finish. This turned out to be quite challenging due to the proprietary nature of the .docx file format.
Install LibreOffice on your system.
Due to a warning encountered running LibreOffice on the command line, you may also need to install the Java components for the software:
sudo apt-get install libreoffice-java-common -y
If you haven’t already done so, install Python3 and PIP:
sudo apt install python3 -y
sudo apt install python3-pip -y
Install Flask, PyPDF2, FPDF, and pdf.tocgen:
sudo pip3 install flask -y
sudo pip3 install pypdf2 -y
sudo pip3 install FPDF -y
sudo pip3 install pdf.tocgen -y
Clone the project:
git clone https://github.com/rbrutherford3/docx-Publisher.git
Optionally adjust the Flask settings prior to running:
export FLASK_DEBUG=0
export FLASK_ENV=development
Run the program:
cd /path/to/docxpublisher
python3 flask -m flask run
You should see something like the following:
* Environment: development
* Debug mode: off
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
This means you can now go to localhost:5000
or 127.0.0.1:5000
in your browser to use the program.
You can also use Gunicorn to set up this project for production, but that is outside the scope of this document
Please contact rbrutherford3 on GitHub if interested in contributing.
Thanks to Dad for providing the inspiration for this program, and for putting up with me over the years.