Google sheet automatically generate a pdf and send an email to notify

I need to write a script that allows me to automatically save a pdf after the data has been refreshed and send people an email.
The current problem is that there are too many columns in the google sheet(from A to AZ) and we need all the columns in the pdf.
In download as pdf, we have the option to set it as normal and split
enter image description here

enter image description here

Is it feasible in appscript?

function refreshAndSendEmail() {
  const ss = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/xxxxx');
  const tabsToSnapshot = ['a', 'b']; // Replace with the names of the tabs you want to snapshot

  tabsToSnapshot.forEach(tabName => {
    const dataSheet = ss.getSheetByName(tabName);
    if (dataSheet) {
      refreshDataSourcesForSheet(dataSheet);

    } else {
      console.log(`${tabName} not found.`);
    }
  });

  const pdfBlob = generatePDF(ss);
  sendEmailWithAttachment(pdfBlob);
}

function refreshDataSourcesForSheet(sheet) {
  const dataSources = sheet.getDataSourceTables();
  dataSources.forEach(dataSource => {
    dataSource.refreshData();
    console.log(`Last refresh time for ${dataSource.getName()}: ${dataSource.getStatus().getLastRefreshTime()}`);
  });
}


function generatePDF(ss) {
  const spreadsheetId = ss.getId();
  const fr = 0, fc = 0, lc = 9, lr = 27;
  const url = "https://docs.google.com/spreadsheets/d/" + spreadsheetId + "/export" +
    "?format=pdf&" +
    "size=7&" +
    "fzr=true&" +
    "portrait=true&" +
    "fitw=true&" +
    "gridlines=false&" +
    "printtitle=false&" +
    "top_margin=0.5&" +
    "bottom_margin=0.25&" +
    "left_margin=0.5&" +
    "right_margin=0.5&" +
    "sheetnames=false&" +
    "pagenum=UNDEFINED&" +
    "attachment=true&" +
    // "gid=" + sheet.getSheetId() + '&' +
    "r1=" + fr + "&c1=" + fc + "&r2=" + lr + "&c2=" + lc;
  const options = {
    headers: {
      Authorization: 'Bearer ' + ScriptApp.getOAuthToken()
    }
  };


  const response = UrlFetchApp.fetch(url, options);
  const pdfBlob = response.getBlob().setName('Snapshot.pdf');
  return pdfBlob;
}

// function setPrintArea(sheet, printAreaRange) {
//   const range = sheet.getRange(printAreaRange);
//   sheet.setActiveRange(range);
//   const spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
//   spreadsheet.setNamedRange('Print_Area', range);
// }


function sendEmailWithAttachment(pdfBlob) {
  const recipient = 'email'; // Replace with the recipient's email address
  const subject = 'Snapshot of Data';
  const body = 'Please find the snapshot of data attached.';
  
  MailApp.sendEmail({
    to: recipient,
    subject: subject,
    body: body,
    attachments: [pdfBlob]
  });
}