Archive
Convert your wordpress blog to a PDF book
You have a wordpress blog (.com or .org), and you would like to convert the whole blog to a PDF book. That is, convert every post to PDF and then join the pieces. The final result should be a single PDF, like a book.
Related work
An easy, simple, and free solution is offered by LJBook. Just upload your exported blog, and they generate a single PDF out of it.
However, I had a problem with it. My blog contains lots of source codes and unfortunately those blocks are not treated correctly by LJBook. So, I had to find another solution.
My solution
Here is a sample PDF and my whole blog (up to March 6, 2011). With my method, you can generate such an output.
The current version of the script (written in Python) is available here.
Steps to follow:
- Download the script above and put it in a directory. In this directory, create a subdirectory called “
pieces“. The script will download the HTML files here, and the PDF outputs are also stored in this subdirectory. - Customize the beginning of the script: blog name, username, password, etc.
- The HTML to PDF conversion is done with WKhtmlToPDF. Here you will find more info about this tool and how to get it. Download it and store the binary here:
/opt/wkhtmltopdf/wkhtmltopdf-i386. - Optional: disable the side bar on your wordpress blog. I don’t think you want to see the side bar on each page in the PDF book :) Refer to this post to figure out how to hide the side bar.
- Now everything is set, you can launch the script. If everything is fine then the script will download each public post on your blog and convert them to PDF. Warning! When you launch the script, it will delete all *.html and *.pdf files in the directory “
pieces“! - Once you have all the PDFs, enter the directory “
pieces” and join the PDFs: “pdftk *.pdf cat output book.pdf“. If you don’t havepdftk, install it (sudo apt-get install pdftk). - When ready, don’t forget to set back the side bar on your blog.
- You might want to edit the final PDF. It is almost sure that it will contain some empty pages; you can remove them with a PDF editor.
Archives List Generator for wordpress.com
Problem
I wanted to have an “Archives” page that lists the titles of my posts. This way, I could find the post I’m looking for much easier. Unfortunately I didn’t find this functionality on wordpress.com. I was searching for a solution and I found WordPress ListMaker v2. However, the author provides an EXE only and his program requires your username. This is something I would never give out… On the other hand, I use Linux, so I prefer open source solutions.
So I’ve decided to write a Python script that produces an HTML output, similar to WordPress ListMaker v2.
Demo
You can see my Archives list here. It was generated with my script.
Download
Visit https://github.com/jabbalaci/Archives-List-Generator. Source code is here.
Solution
In a previous post I showed how to get the list of your blog posts. This script is an extended version, it simply produces a formatted HTML output.
Usage:
Modify the beginning of the script: precise the address of your blog, your username, password, etc. Then just simply execute the script. You can redirect the output to a file, then paste the contents of the file to your wordpress.com blog.
[ @reddit ]
Blog Stats
- 312,414 hits
Random Post
Recent Posts
Tags
Categories
Blogs that I follow
Archives
- May 2013 (9)
- April 2013 (20)
- March 2013 (10)
- February 2013 (7)
- January 2013 (26)
- December 2012 (18)
- November 2012 (13)
- October 2012 (9)
- September 2012 (8)
- August 2012 (7)
- July 2012 (3)
- June 2012 (9)
- May 2012 (16)
- April 2012 (32)
- March 2012 (18)
- February 2012 (17)
- January 2012 (12)
- December 2011 (8)
- November 2011 (18)
- October 2011 (18)
- September 2011 (32)
- August 2011 (13)
- July 2011 (16)
- June 2011 (6)
- May 2011 (14)
- April 2011 (30)
- March 2011 (45)
- February 2011 (42)
- January 2011 (28)
- December 2010 (14)
- November 2010 (29)
- October 2010 (15)
- September 2010 (5)

