Skip to main content

toDataURL()

Last updated 5/02/2024

Example

The following code adds attachments to a mail merge as embedded data URLs.

Adding attachments as data URLs
function DoAddSubmissionAttachments(five: Five, context: any, result: FiveError): FiveError {
if (context.Attachments && context.Attachments.length > 0) {

for (let i = 0; i < context.Attachments.length; i++) {
const attachment = context.Attachments[i];
five.addAttachment(five.toDataURL('application/pdf', attachment.file), attachment.name);
}
}

return five.success(result);
}