I'm modifying a pdf using the code below but struggling with how to create a buffer that can then be used as an email attachment without writing anything to disk.
I'm finding it hard to work out from the documentation.
var pdfWriter = hummus.createWriterToModify(__dirname + '/voucher.pdf', needToCreateBuffer);
var pageModifier = new hummus.PDFPageModifier(pdfWriter, 0);
var fontOswald = pdfWriter.getFontForFile('.fonts/Oswald-Bold.ttf');
pageModifier.startContext()
.getContext()
.writeText(
'£100',
296, 105, {
font: fontOswald,
size: 70,
colorspace: 'gray',
color: 0x00
}
).writeText(
'CODE: GHGJHJHH',
296, 80, {
font: fontOswald,
size: 18,
colorspace: 'gray',
color: 0x00
}
);
pageModifier.endContext().writePage();
pdfWriter.end();