Refactoring generate pdf method
Removing Trailing Whitespaces and Simplifying Renders
Refactoring and removing trailing whitespaces