Comment on page
Generate Document lets you generate a PDF document that can be saved to a database-connected File Data Source. The file is generated by a Template String written in HTML. The Template String can be set using a Data Binding, a Text Editor or a Function. If using a Function, parameters can be added using
If you are writing your own HTML for the document it might be useful to preview the result. This can be done by storing the code in its own file with the file extension .html and then opening the document with your browser.
An example setup of Generate Document is showcased in our Showroom! You may view a demo, as well as access the setup in Appfarm Create. You may also use the HTML templates found in the Template String setting of the Generate Document actions in Create. If you do not have access, you may register here.
<html>…</html>: The root element of the HTML document that all other elements are contained in.
<head>…</head>: The container element for processing information and metadata in the document. This container can include elements, as, for example
<style>…</style>, which specifies the CSS style for the document.
<title>…</title>specifies the document title and
<meta>…</meta>can be used to specify additional metadata for the document.
<body>…</body>: The container element for the visible content of the document. There is a long list of elements that can be used to generate the body of the document. Some elements are listed below: –
<div>…</div>: a generic container element with no semantic meaning –
<p>…</p>: a paragraph –
<h1>…</h1> - <h6>…</h6>: section headings, where
h1is the highest level heading, while
h6is the lowest-level heading. –
<ol>…</ol>ordered list or
<ul>…</ul>unordered list, with
<li>…</li>as list elements. –
<table>…</table>a table with
<th>…</th>table header cells and
<td>…</td>table cells. –
<img>…</img>: an image tag used to display images.
Example of a simple HTML Template String for the Generate Document action node. This example is also found in Showroom.
Printing of background colors and graphics from webpages is typically turned off by default. The same applies when using Generate Document. In order for background colors and graphics to be included in your PDF, you can add the following code to your document HTML. Note that even though the styling is applied to the
<body>element, it will apply only to its descendants.