INNER CODE UNIT · JavaScript
clip
mermaid-js/mermaid-cli · src/index.js:864
const clip = await page.$eval("svg", (svg) => {
const react = svg.getBoundingClientRect();
return {
x: react.left,
y: react.top,
width: react.width,
height: react.height,
};
});
return {
...metadata,
data: await page.pdf({
omitBackground: backgroundColor === "transparent",
printBackground: true,
width: Math.ceil(clip.width) + clip.x * 2 + "px",
height: Math.ceil(clip.height) + clip.y * 2 + "px",
pageRanges: "1-1",
}),