Generate PDF document
You might want to generate PDF files from your tables for reporting and other purposes. Here's how you can do it in UI Bakery:
We suppose that by this time you have already connected your app to the data source
  1. 1.
    Load your data and add a Table to display it. For example, we will load a table with users' data.
  2. 2.
  3. 3.
    Specify the below code:
1
const doc = new jspdf.jsPDF();
2
3
doc.autoTable({
4
head: [['ID', 'Name', 'Email', 'Bio']],
5
body: {{ui.loadUsers.value}}.map(({ id, fullName, email, bio }) => ([id, fullName, email, bio])),
6
});
7
8
doc.save('users.pdf');
Copied!
Please note the code is exemplary and needs to be modified based on your table's and necessary file's structure
As the next step, add a Button that will download the generated file.
Open Button's settings, navigate Triggers&condition tab and assign the generatePDF action to the On Click trigger.
Last modified 1d ago
Copy link