Skip to main content

Dynamic PDF

In this video tutorial you will understand how to generate dynamic PDF using your collection data such as invoices, receipts, reports and much more.

Intro

Dynamic PDFs in a web app involve generating personalized PDF documents in real-time, typically from database-driven content like invoices or reports, and dynamically embedding data into predefined templates for user-specific information.

Let's look at the usecase below for a better understanding.


1. Create PDF snippet

Go to Snippets, choose Add Snippet. Then choose the PDF Template option. Choose the Collection for the PDF and click Create Snippet.

DrapCode Builder Collection Field

2. Bind a Collection to PDF Snippet

Open the Snippet and choose a collection to bind to the snippet from which you can download data.

DrapCode Builder Collection Field

3. Create Event to Generate PDF

Go to Events and choose Add Event. Here choose Snippet > Generate PDF from Snippet.

DrapCode Builder Collection Field

4. Drop Page Component

Drop any Components, say, Data Table. Open its Settings and bind the collection to the page component (Data Table).

DrapCode Builder Collection Field

5. Bind Event to the Component

Open the Settings of the Button and choose the event to bind to it; so, whenever you click it it will run the event to generate PDF.

DrapCode Builder Collection Field

6. Download PDF

Now that the settings are in place you can use the Preview or the Publish options to generate and download the PDF.

DrapCode Builder Collection Field

Conclusion

When you automate the process of generating PDF documents based on dynamic data, you streamline repetitive tasks that would otherwise be time-consuming and error-prone if done manually.