Hi Ron,
I have notified the team regarding increasing the timeout. I will keep you informed of any updates.
Meanwhile, and I believe you may need it, you can generate a PDF for each studyGroup, then merge them into a single PDF when you send the email.
This is an example of how to achieve it, which I am regenerating 4 reports, combining and merging them into 3 PDF files:
function DoAddAndMergeAttachments(five, context, result) {
const reportResult0 = five.executeAction('StaffExtension', {});
if (reportResult0.isOk() === false) {
return five.createError(reportResult0);
}
const reportResult1 = five.executeAction('WebProductsReport', {});
if (reportResult1.isOk() === false) {
return five.createError(reportResult1);
}
const reportResult2 = five.executeAction('PositionReport', {});
if (reportResult2.isOk() === false) {
return five.createError(reportResult2);
}
const reportResult3 = five.executeAction('StaffReport', {});
if (reportResult3.isOk() === false) {
return five.createError(reportResult3);
}
const pdfs1 = \[\];
const pdfs2 = \[\];
// Array pdfs1 with reports (StaffExtension and WebProductsReport)
if (reportResult0.report) {
pdfs1.push(reportResult0.report);
}
if (reportResult1.report) {
pdfs1.push(reportResult1.report);
}
// Array pdfs2 with reports (PositionReport, and StaffReport)
if (reportResult2.report) {
pdfs2.push(reportResult2.report);
}
if (reportResult3.report) {
pdfs2.push(reportResult3.report);
}
// Array pdfs3 with reports (StaffExtension, WebProductsReport, PositionReport, and StaffReport)
const pdfs3 = \[\];
pdfs3.push(...pdfs1, ...pdfs2);
//Store the PDF utility method.
const pdfUtils = five.pdfUtils();
//Merge reports (StaffExtension and WebProductsReport) into PDF pdf1
const mergedPDF1 = pdfUtils.merge(pdfs1);
if (mergedPDF1.isOk && mergedPDF1.isOk() === false) {
return five.createError(mergedPDF1, 'Failed to merge pdf1 files for attaching');
}
let attachResult1 = five.addAttachment(mergedPDF1, "pdf1.pdf");
if (attachResult1.isOk() == false) {
return five.createError(attachResult1);
}
//Merge reports (PositionReport, and StaffReport) into PDF pdf2
const mergedPDF2 = pdfUtils.merge(pdfs2);
if (mergedPDF2.isOk && mergedPDF2.isOk() === false) {
return five.createError(mergedPDF2, 'Failed to merge pdf2 files for attaching');
}
const attachResult2 = five.addAttachment(mergedPDF2, "pdf2.pdf");
if (attachResult2.isOk() == false) {
return five.createError(attachResult2);
}
//Merge all reports (StaffExtension, WebProductsReport, PositionReport, and StaffReport) into PDF pdf3
const mergedPDF3 = pdfUtils.merge(pdfs3);
if (mergedPDF3.isOk && mergedPDF3.isOk() === false) {
return five.createError(mergedPDF3, 'Failed to merge pdf3 files for attaching');
}
const attachResult3 = five.addAttachment(mergedPDF3, "pdf3.pdf");
if (attachResult3.isOk() == false) {
return five.createError(attachResult3);
}
return five.success(result);
}
Below is the definition for the SetPDFQuality function (we are in the process of updating our documentation). The properties definition is:
ImageQuality: Set the quality of the pdf content. Example: default is 1, meaning 100%, 0.6 means 60%.
ImageType: The report generates an image for each page during PDF creation, which is then compiled and converted into a final PDF.
The supported types are ‘png’ and ‘jpeg’
Regards,
Elton S