Completed the PDF functionality