I am very new with Apps Script and I am trying to generate a pdf file upon form submission and send it in an email. I have been trying to fix this for a over a week. I have watched every on tutorial and read numerous articles multiple times to see if I can find where my mistakes are. I am getting 2 errors
Can someone help me with this? The code that I have so far is below:
function afterFormSubmit(e){
const info = e.namedValues;
createPDF(info);
}
function createPDF(info) {
const pdfFolder = DriveApp.getFolderById("1tSVmV7-HzZHoYYPBfG1cdImNGuckB2S3")
const tempFolder = DriveApp.getFolderById("1oqyfbwjr21OaPi3rCICgZhIQrU6C4wwA")
const templateDoc = DriveApp.getFileById("18F0iOfZ_Iu71UxjDzRDVjFMRvBA20ATnRX8-E8cy5q0");
const newTempFile = templateDoc.makeCopy(tempFolder)
const OpenDoc = DocumentApp.openById(newTempFile.getId());
const body = OpenDoc.getBody();
body.replaceText("{dt}", info['Timestamp'][0]);
body.replaceText("{cn}", info['Company Name:'][0]);
body.replaceText("{jc}", info['Job Code:'][0]);
body.replaceText("{st}", info['Scope of Work Type:'][0]);
body.replaceText("{ot}", info['If "Other", please specify:'][0]);
body.replaceText("{dc}", info['Description of Change:'][0]);
body.replaceText("{mc}", info['Materials and Cost:'][0]);
body.replaceText("{lc}", info['Labor Cost:'][0]);
body.replaceText("{tx}", info['Tax Cost:'][0]);
body.replaceText("{tl}", info['Total:'][0]);
OpenDoc.saveAndClose();
const blobPDF = newTempFile.getAs(MimeType.PDF);
const pdfFile = pdfFolder.createFile(blobPDF).setName(info['Job Code:'][0] + " " + info['Company Name:'][0]);
tempFolder.removeFile(newTempFile);
}