The Save as PDF control takes a snapshot of the View/Form at a particular point in time when an Event is executed, for example when a Button is clicked. The PDF snapshot is saved to a SmartObject and executed by using one of the Execute Control Method actions.
Internet Explorer 9 or Internet Explorer 10 is required to be installed on the K2 Host Server to render PDF documents
Follow the steps below to apply the Save as PDF control to a:
Easy
Advanced
Page Size | Pixel/inch (control) | Pixels (Form Width) |
---|---|---|
A0 | 33,1 | 3178 |
A1 | 23,4 | 2246 |
A2 | 16,5 | 1584 |
A3 | 11,7 | 1123 |
A4 | 8,3 | 797 |
A5 | 5,8 | 557 |
A6 | 4,1 | 394 |
A7 | 2,9 | 278 |
A8 | 2 | 192 |
A9 | 1,5 | 144 |
A10 | 1 | 96 |
ArchA | 9 | 864 |
ArchB | 12 | 1152 |
ArchC | 18 | 1728 |
ArchD | 22 | 2112 |
ArchE | 34 | 3264 |
B0 | 39,4 | 3782 |
B1 | 27,8 | 2669 |
B2 | 19,7 | 1891 |
B3 | 13,9 | 1334 |
B4 | 9,8 | 941 |
B5 | 6,9 | 662 |
Flsa | 1,5 | 144 |
HalfLetter | 8,5 | 816 |
Ledger | 17 | 1632 |
Legal | 8,5 | 816 |
Letter | 8,5 | 816 |
11x17 | 11 | 1056 |
Note | 7,5 | 720 |
The Save as PDF control is available in the Export section of the Controls tab in the Toolbox.
Properties | Description | Can be set in runtime using Rules |
---|---|---|
Name | A unique identifier for the selected control. This property is required | No |
SmartObject | The SmartObject to be used when saving the PDF. The SmartObject should have a Create type function, See Method, a File Property, a Number/Autonumber property, and a text property | No |
Method | The method to be used to create the PDF. Only Create type functions are supported | No |
File | The File type property is required for the SmartObject. The file type to be selected must always be PDF. | No |
Key Property | The unique identifier of the SmartObject where the PDF file will be saved | No |
File Name | The name of the PDF file created. This field is empty by default. If no name is specified, the default file is called PDFFile.pdf. Rules and Expressions can be used to set the File Name if a unique name is required per PDF File. | Yes, see Control Properties Actions for more information |
Append Date | A Boolean value used to establish whether the date should be added to the end of the file or not. By default the option is selected which will then append the date. | Yes, see Control Properties Actions for more information |
Page Size | A list of sizes available for the creation of the PDF document. The following sizes are available:
|
Yes, see Control Properties Actions for more information |
Page Orientation |
The following options are available:
|
Yes, see Control Properties Actions for more information |
Clean IFrames |
Set to True by default. Definitions:
|
Yes, see Control Properties Actions for more information |
When clicking on the ellipsis next to SmartObject in the Data Source section of the Properties, the Configure SmartObject screen opens. Configure the SmartObject to be used when creating the PDF. A system PDF File SmartObject is created and can be used to save all PDF's. In addition, a custom SmartObject can be created for this purpose.
Fields | Description |
---|---|
SmartObject | The SmartObject to be used when saving the PDF |
Method | The method to be used to create the PDF. This should be a Create method |
File | The File type property is required for the SmartObject. The file type to be selected must always be of File Type property. |
Key Property | The unique identifier of the SmartObject where the PDF will be saved |
A Rule needs to be configured to execute a PDF method. The methods available for the Save as PDF control are discussed in the section below. One of the Execute Control Method actions can be used to execute these methods. Below is an example to show how a Rule is configured to execute a PDF method:
When executing the control method, the value of the control is set to the Key Property as selected in the SmartObject that is used as the Data Source of the Save as PDF control. One example is where the control's value is mapped to a Data Field in a workflow and a Load method is executed on the SmartObject to attach the PDF File to an e-mail. The Key Property is used as a way of identifying the SmartObject that hold the new PDF document. For good practice this should be generated during the execution of the SmartObject method and be unique, auto numbers work well. It is however possible that the Key Property value will not be unique if good practices were not followed.
The following methods are available:
The following Events are available for both methods mentioned above:
These Events are available in the Rule Designer after using the SavePDF or SavePDFAsync methods. An Action can be configured to execute before or after the PDF is created. One example is where the SavePDFAsync method is used and you want to add a Label to the document before it is saved as a PDF to indicate that it's a copy of the original document. A Rule can be configured to show the Copy Label control before the PDF is saved. The Rules will look like this:
Event: When a control on the View raises and Event
Action: Execute a control's method
Event: When a control on the View raises and Event
Action: Show a control
See KB001378 - How to use the synchronous and asynchronous execution options of the Save as PDF control for detailed information about the application of the different execution types.
The PDF File created can be accessed by creating a List View of the PDF File SmartObject (system SmartObject) which can be found in the following location or alternatively in the location where the existing SmartObject was created:
The PDF File is displayed as a link in the List View
When clicking on the PDF link of the List View, the PDF File opens in Adobe Reader
An existing SmartObject can be used when saving the PDF File. The following SmartObject functions are required:
This SmartObject can then be selected as the Data Source of the Save as PDF control. The PDF files will be saved to this SmartObject and a List View can be created of this SmartObject to view the PDF files created.
The system PDF File SmartObject is automatically available for use in a SmartForms workflow. If an existing SmartObject was used as the Data Source of the Save as PDF control, or if a new SmartObject was created for this purpose it should be workflow enabled before use in a SmartForms workflow. To enable workflow functionality for the specific SmartObject, select the Allow this SmartObject to be used in Workflows option on the details screen of the SmartObject Designer. The Get List method of this SmartObject can then be used to attach the PDF file for example to an e-mail.
The Save as PDF control can be used to attach the created PDF file to an E-mail in a workflow. In order to do this a Parameter can be used for example or mapping the value of the control in the context of the method being executed. In the example below we are using a Form Parameter and a Workflow Data Field for this purpose. It is important to note that the PDF value will not necessarily represent a Number value and the Parameter or mappings used must correlate to the PDF ID field type. The ID of the default PDF File SmartObject is of type Autonumber, but if a custom SmartObject was created for use with the PDF for example, the Unique property might be of another type.
See the following Knowledge Base articles:
KB001392 - How to attach a PDF file to an E-mail Event in a workflow
KB001394 - How to attach a PDF file to an E-mail Event in a workflow using a Form Parameter
In the image below the Save as PDF control is used on a Form.
A Parameter is added to the Form to map the PDF details. This Data Type should correlate to the ID of the PDF SmartObject and the Data Field Type that will be used in the workflow to perform the mapping.
Rules are configured to execute the Save as PDF control's method to create the PDF and then transfer the data from the PDF control to the Parameter.
Note that the PDF control is dragged to the Parameter field
When creating a Data Field in the Workflow, it is important to use the same Data Type as was used when creating the Parameter. The Parameter is then mapped to this Data Field in the Workflow.
The PDF Load method is used in the Attachments field of the E-mail event as shown below and the Workflow Data Field is in turn used in the mapping to the PDF Load method
Video | Links | Learn | Support |
No videos found for this article K2 on YouTube
No Additional links found for this article
No self-learning content for this article Try some scenarios...
No relevant support links available for this article
|