abstract the pdf creation to clear