Create PDF
Generate a PDF from an HTML template. If it is not available as standard in your Studio, you can download this system service from Grexx Marketplace.
Input
Use a casetype activity to add inputs to the Start create PDF form.
| Attribute | Data type | Mandatory? | Description |
|---|---|---|---|
| Case ID | Case ID | No | Case ID where information is retrieved. If this is empty then the current case is used. |
| Filename | String | Yes | Name of the file being generated. |
| Template (ID) | Case ID | Yes | ID of the template used to generate the file. For more information, see HTML template below. |
| Content | String | No | If you are not using an HTML template to generate the file, you can specify the text to include in the PDF. |
| Paper margin | String | No | The margin of the pages. Default is 1cm. Values like 2cm and 3.2cm are permitted. |
| Paper orientation | String | No | Either portrait or landscape. |
| Paper size | String | No | Default is A4. Values like A3 and A5 are permitted. |
| Header HTML | String | No | HTML for the document header. |
| Header height | String | No | Height of the header (e.g. 2.3cm or 100mm). |
| Footer HTML | String | No | HTML for the document header. |
| Footer height | String | No | Height of the footer (e.g. 2.3cm or 100mm). |
| Engine | String | No | Choose between legacy and chromium. Always choose chromium for new PDFs. |
Output
Outputs are added to the Result create PDF form when the Systemservice create PDF case is closed.
| Attribute | Data type | Mandatory? | Description |
|---|---|---|---|
| Output file | File | Yes | The PDF file. |
| Error | String | No | Errors that occurred when creating the PDF file. |
HTML template
To define the HTML template for the PDF, add a saved template to your Studio.
With chromium you use <span class="pageNumber"></span> and <span class="totalPages"></span> in your header/footer HTML for the page number and the total number of pages respectively.
With legacy you use {{page}} and {{pagetotal}}.
To process special characters (such as accents) correctly, add the following line to the <head> section of the HTML:
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"\>
</head>
<body>
...
</body>
</html>
Example HTML
<!DOCTYPE html>
<html>
<head>
<title>PDF Document</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style>
@import url('https://fonts.googleapis.com/css?family=Open+Sans');
@page {
size: A4 portrait;
}
body {
font-family: "Open Sans", Helvetica, Verdana, sans-serif;
}
.page {
/* A4 portrait height: 297mm*/
height: 254mm;
page-break-inside: avoid;
padding: 2cm 2cm 0 2cm;
margin: 0;
overflow: hidden;
}
.pages {
page-break-inside: avoid;
page-break-after: always;
padding: 2cm 2cm 0 2cm;
margin: 0;
}
</style>
</head>
<body>
<!-- Opening page -->
<div class="page">
Page 1 consists of a single page.
If there is more content than fits on one page, it is not included.
</div>
<div class="pages">
Everything within this div becomes multiple pages.
If this contains 1.5 pages of content, the second page will be half empty.
After this div, a new page starts.
</div>
<!-- Closing page -->
<div class="page">
The final page consists of a single page.
If there is more content than fits on one page, it is not included.
</div>
</body>
</html>