PyPDF2
is very good choice when you need to change existing PDFs, but it requires deeper knowledge of pdf format when you need to create PDF from scratch.
You might consider using a different library for this task i.e. pdfkit
(https://github.com/JazzCore/python-pdfkit), sample program:
import pdfkit
pdfkit.from_url('http://google.com', 'out.pdf')
pdfkit.from_file('test.html', 'out.pdf')
pdfkit.from_string('Hello!', 'out.pdf')