Warning!
This is a legacy document. The features described below are only usable within the classic generation environment.
Currently, Betty Blocks offers faster and more advanced options that are available in next-gen. Before you start working on this feature in your application, consider using the way described in Using PD-generator step article.
Good luck!
You can apply a portable data format (pdf) for specifying the format and layout of data from your application. Using a pdf as the property type, you can ensure the integrity of the information contained in an output file.
This article contains:
An explanation of pdf properties and templates
How to create a pdf property and how you associate it with a template
Actions that you can create that result in pdf
PDF properties and templates
Every PDF property that you create requires a template. The template defines how the details in a file are presented. You can create a template before you create a pdf property and apply that template to the property.
Note: Betty Blocks employs PrinceXML for generating PDF's. This combines a html (structure) with css (styling) and Liquid (dynamic content). Examples and templates are available on the PrinceXML website.
The setup of a PDF template is the same as a standard HTML page: |
<html> |
You can add additional style settings in the page. For example, to set the an A3 landscape page size, specify: |
@page { |
You an also specify a page number in the bottom right of each page: |
@page { |
You can also apply cascading style sheet (CSS) formatting such as for text alignment in tables: |
@page { |
You can dynamically load data in the table using Liquid. For example, to dynamically include specific lines of data in an invoice: |
Title |
Creating a PDF File property
1. Click on New property in the model. |
2. Open the Type menu and select Pdf as the property type. The options available are calibrated to show the pdf related options. |
3. Specify a Name for the property. |
4. With Static template selected, open the pull-down menu to select either New or an existing template where one exists. Only New is displayed if templates have not yet being created. Where you want to create a new template, specify a Filename (A). Tip! The file name is a set name for the pdf file when it is downloaded. You can set a name that is related to the content in the file. For example, invoice for an invoice pdf file.
You can use the radio buttons o specify
Where Dynamic Template (D) is selected, you can use a condition to set a template. A template is set in this field using the UUID of the template. You can find the UUID in the url when you open the template. Example condition: |
5. Click on the edit button. The previous IDE is opened. The name displayed shows that the file specified in step 4 is the template file displayed. |
6. Specify the required HTML for the template. |
7. Press the Save button the details you have applied. |
8. Return to the open model property view (via the browser tab) to click Save for the newly created property. |
Note: PDF templates use variables to set data. You need to assign variables for the property so that they are used with the template.
|
As PDF templates use variables to set data, you need to assign variables to the property. You can open the model |
Adding variables for a PDF property
You can add variables to a PDF property in the previous environment. |
1. Open the list of models. |
2. Select the model for which you have create a PDF property. The reservation model (A) is used in this example. |
3. Click on Properties to open the property details for the model |
4. Select the pdf property. In this example, the ReservationForm is |
5. The property details are displayed (A). In the variable field, you can enter the details for the variables (B). Press on the Add (C) button to add additional variables. |
6. Press Save to save the details you have applied. |
Using PDF properties in action events
There following action events use PDF properties:
Pdf generate
Pdf merge
How these events are applied is explained in the following sections. As this functionality is still managed in our previous platform, the instructions below are based on the previous environment.
Note: We are constantly updating the Betty Blocks platform to increase the ease-of-use of our platform. Functionality that is currently still managed in our previous IDE may also be available in our updated platform. You can send a message using the support button where you need to check the current status when applying certain settings or building certain functionality for your application. You can also refer to the Product changes for a list of updates to the platform. |
Action Event: Pdf generate
To generate a Pdf file in the Pdf file properties of a selected object: |
|
Action event: Pdf merge
Using this event, you can merge multiple Pdf files of the same property into one single Pdf file. If the Pdf file property does not yet contain a file, it is generated before merging. This event is always executed as a background job. |
|