First version of pdf generation