Data Operations allow you to perform a multitude of operations over data. In this article we’ll go over Airkit's ability to create PDFs. You can create PDF via 2 different methods:
- Generate a PDF file from an HTML input
- Fill an existing PDF Form
PDF generated on Airkit can be transferred to either the user or an external system. This allows you to use these PDF capabilities everywhere, from within your app to remitting to external sources.
Let's dive into how you create and fill PDF's with Airkit.
Adding a Data Operation
Once you’ve opened your application in Airkit Studio, head on over to the Connection Builder to get started.
Inside Connection Builder, click on the ‘+' next to Data Operations to add a new Data Operation, and name it whatever you’d like.
HTML to PDF
This data op is specially useful when needing to collect and process information that is generated along your application journey and dump it into a downloadable file.
This data operation has two mandatory settings and a couple more that can be left blank for the purpose of learning how to use it (but which may come in handy in a real world usage).
HTML: is the HTML code you’ll want converted into a PDF file.
PDF Filename: is the name the data op will use to name the resulting PDF file.
When running the Data Operation, the HTML to PDF will build a PDF asset from the HTML entered and the object returned will contain the download url of the asset.
Fill PDF Form
Sometimes you’ll want to fill in information into a PDF Fillable Form instead of creating the PDF file from scratch.
This is what the Fill PDF data op is for: you can collect and process information that is generated along your application journey and then insert it into pre-defined fields in a PDF form.
This data operation has three mandatory settings. There are a couple more that can be left blank for the purpose of learning how to use it (but which may come in handy in a real world usage).
Filename: is the name the data op will use to name the resulting PDF file.
PDF File Asset Identifier: is asset URI of your PDF form. To obtain it, you will need to have your PDF form uploaded into your app’s Media Library, select it from the list of files and copy the URI shown on the right hand properties pane.
Data to Fill: is the payload that you will insert into the PDF form.
Where key_name is the name of the PDF form text field you’d like to insert payload_value into.
When running the Data Operation, the payload will be inserted into the PDF form and the object returned will contain the download url of the asset (along other properties).