Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function handleRequest(event) {
var jsPDF = require('jspdf/dist/jspdf.node.min');
var doc = new jsPDF({
"orientation": "p",
"unit": "mm",
"format": "a4"
});
var xmargin = 25.4;
var ymargin = 25.4;
var imgResponse = await fetch('https://regmedia.co.uk/2017/06/26/cloudflarelogo.jpg', {
"cf": {
"cacheTtl": 9999999999999999999
}
});
var imgData = _arrayBufferToBase64(await imgResponse.arrayBuffer());
doc.addImage(imgData, 'JPEG', xmargin, ymargin);