CreatePdf method has been split further