Links

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:
  1. 1.
    In the App's settings - Code tab, specify the code below and save the changes:
<script src="https://unpkg.com/[email protected]/dist/jspdf.umd.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/jspdf.plugin.autotable.js"></script>
2. Load your data and add a table to display it. For example, we will load a table with users' data.
3. Add a new action - Code. Specify the below code:
const doc = new jspdf.jsPDF();
doc.autoTable({
head: [['ID', 'Name', 'Email', 'Bio']],
body: {{ui.loadUsers.value}}.map(({ id, fullName, email, bio }) => ([id, fullName, email, bio])),
});
doc.save('users.pdf');
Please note the code is exemplary and needs to be changed based on your table's and necessary file's structure
4. As the next step, add a Button that will download the generated file.
5. Open the Button's settings, navigate Triggers&condition tab and assign the generatePDF action to the On Click trigger.