Published
Edited
Apr 4, 2022
1 star
Also listed in…
Tips and Utilities
Insert cell
Insert cell
Insert cell
Insert cell
template = ({
basePdf: PDFME.BLANK_PDF,
schemas: [
{
a: {
type: 'text',
position: { x: 0, y: 0 },
width: 10,
height: 10,
},
b: {
type: 'text',
position: { x: 10, y: 10 },
width: 10,
height: 10,
},
c: {
type: 'text',
position: { x: 20, y: 20 },
width: 10,
height: 10,
},
},
]
});
Insert cell
inputs = [{ a: 'a1', b: 'b1', c: 'c1' }];

Insert cell
PDFME.generate({ template, inputs }).then((pdf) => {
console.log(pdf);

// Browser
const blob = new Blob([pdf.buffer], { type: 'application/pdf' });
//window.open(URL.createObjectURL(blob));
mutable url = URL.createObjectURL(blob)

// Node.js
// fs.writeFileSync(path.join(__dirname, `test.pdf`), pdf);
});
Insert cell
mutable url = ''
Insert cell
html`<a href="${url}" download>download PDF</a>`
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more