Split generate_pdf.py. Add tools file for generical function like render