Added the code to generate the pdf and get the corresponding byte array. Also added the verification of the file extension of the template file path.