Refactor pdf