vtdocs-helloworldpdf.express.val.run
Readme

You can render PDFs on Val Town using the jspdf library (and presumably other libraries too!)

1
2
3
4
5
6
7
8
// View me at https://vtdocs-helloWorldPDF.express.val.run!
export const helloWorldPDF = async (req: express.Request, res: express.Response) => {
const { jsPDF } = await import("npm:jspdf");
const doc = new jsPDF();
doc.text("Hello world!", 10, 10);
res.set("Content-Type", "application/pdf");
res.send(doc.output());
};
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
October 23, 2023