more refactor of GetPdf