refactoring in Pdf class