You can generate PDFs using val functions by using an external library like jsPDF.
https://www.val.town/embed/neverstew.helloWorldPDF
Here’s a more comprehensive example that builds an invoice.
https://www.val.town/embed/neverstew.examplePDF