Readme

An example of how to render an invoice using @vtdocs.generateInvoicePDF

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { generateInvoicePDF } from "https://esm.town/v/vtdocs/generateInvoicePDF";
// View me at https://vtdocs-examplePDF.express.val.run!
export const examplePDF = async (req: express.Request, res: express.Response) => {
const invoicePDF = generateInvoicePDF({
invoiceNumber: "001",
date: new Date().toDateString(),
customerName: "Alice Bar",
customerEmail: "alice@bar.com",
items: [{ description: "Arabica Beans 500g", quantity: 2, price: 10 }, {
description: "Robusta Beans 500g",
quantity: 1,
price: 11,
}],
currencySymbol: "$",
});
res.set("Content-Type", "application/pdf");
res.send(invoicePDF);
};
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
generatecoll-examplepdf.web.val.run
v0
November 21, 2023