UNPKG

printmaker

Version:

Generate PDF documents and from JavaScript objects

29 lines 711 B
import { rgb } from 'pdf-lib'; export function renderGuide(page, box, type) { if (page.guides) { const { x, y, width, height } = box; const color = getColor(type); page.pdfPage.drawRectangle({ x, y, width, height, borderColor: color, borderWidth: 0.5, borderOpacity: 0.25, }); } } function getColor(type) { switch (type) { case 'page': return rgb(1, 0, 0); case 'paragraph': return rgb(0, 0, 1); case 'row': return rgb(0, 0.5, 0); default: return rgb(0, 0, 0); } } //# sourceMappingURL=guides.js.map