Refactored some code in the RenderPDFViewController.