Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
font: HELVETIVA_FONT,
size: 12,
}),
// Now we'll draw the Unicorn image on the page's content stream. We'll
// position it a little bit below the text we just drew, and we'll center it
// within the page.
drawImage(UNICORN_JPG, {
x: PAGE_1_WIDTH * 0.5 - UNICORN_JPG_WIDTH * 0.5,
y: PAGE_1_HEIGHT * 0.5,
width: UNICORN_JPG_WIDTH,
height: UNICORN_JPG_HEIGHT,
}),
// Finally, let's draw an ellipse on the page's content stream. We'll draw it
// below the image we just drew, and we'll center it within the page. We'll
// color it cyan, with a purple border.
drawEllipse({
x: PAGE_1_WIDTH * 0.5,
y: PAGE_1_HEIGHT * 0.2,
xScale: 150,
yScale: 50,
borderWidth: 15,
colorRgb: CYAN,
borderColorRgb: PURPLE,
}),
);
// Here we (1) register the content stream to the PDF document, and (2) add the
// reference to the registered stream as the page's content stream.
page1.addContentStreams(pdfDoc.register(contentStream1));
/* =================== 4. Setup and Create Second Page ====================== */
// This step is platform independent. The same code can be used in any