Skip to end of metadata
Go to start of metadata

Instructions - Document templates

Here are collected all the information about the correct template in DOCX format on the basis of which is possible to generate a PDF document.

The same template applies regardless of the way how the pdf generation is started.

Template documentation in the Java API

PDF Creating - nthere is still valid a significant part of the description regarding the creation of templates based on which pdfs are generated. 

Updated documentation

A template is a file saved in DOCX format that allows to generate a document based on it. The template can be added in the system administration: Administration -> ~Document Workflow -> Processes -> (choose a process) -> Edit -> Document templates.

 All necessary information related to the possibility of adding templates (eg creating a new class of documents) are included here.

 

PDF generation types

From the system version 3.2.164 in the system parameters you can choose a new type of generating pdf document (Office). The parameter is in the Documents tab under the name PdfConverter. Description of types:

  • Standard - the default type of document generation. This type of generation has been used from the beginning and will continue to be used after the version update.
  • Office - works only on systems that are running on Windows and the server has the Office 2010+ package installed.

    Generating with the Office type eliminates some of the problems that arise when trying to generate with the default method: 
    1) generates a watermark
    2) generates a table with a large number of rows (10,000+)
    3) correctly generates text styles

 

An exemplary template for presenting the action. The dynamic table was highlighted in color.


The template will be used to generate a document from the above form.

 
Generated document.

 

Templates creating 

A template creating should start with creating a file with the extension .docx. Variables are completed based on their names in the form and must be between two markers '@'.

EXAMPLE

@ gross amount @ will be completed with the current variable value "gross_amount", which is on the form, in this case it will be: 3000.

Full username (from version TO BE COMPLETED)

It is possible to download the user name and surname whose login we have available in the form context (or we added a mapping with the given key).

To complete the place on the form with the full username, use the phrase "@fullusername#variable_with_login @", where "variable_with_login" is the id of form variable/mapping key, which stores the login value.

This phrase can not be used to set the column header with "|".

EXAMPLE

On the form is variable with the id "user" which stores the user login which you are interested in (eg jkowal). In case of enter the phrase "@fullusername#user@" in the document template, the document generator will search user with the login jkowal and in this place the full username will be returned: "Jan Kowalski".


Dynamic tables 

Dynamic tables are the tables that can contain different number of rows depending on the data amount on the form. The function will automatically recognize which table created on the template is dynamic, only if it is created properly.

The dynamic table should contain two lines. The first is as a header, where each cell should contain the variable name placed between two '@' tags, e.g. @account@. Variable names can be replaced with own text by placing the '|' character 'between the variable name and the entered text. The second row should be filled with a capital letter 'T'. If the table header is to be hidden, the capital letter 'H' should be used. Adding a background in the table header underlines that it is a dynamic table. Formatting does not affect the operation of the program.

EXAMPLE

 

For example, a filled dynamic table in the system. 


Dynamic tables in the template. The bottom table will not have a header after it has been generated.


A dynamic table filled with 'T' letter has a header.

A dynamic table filled with 'H' letter has no header.

The mark @ is the recommended variable tag.

Since 3.2.3 PlusWorkflow version , it can be used even if it is used in the content, header and footer of the template (except for mark of variables), e.g. in the email address. e.t.c. Depending on the way of starting the generation, it can not be changed, the change does not ensure correct operation or works correctly also after the change. In earlier versions, it was necessary to replace the @ signs with the phrase: Xsuncode-atXor the use of another variable tag, which was not possible or did not work correctly for all the methods of start.

Note, the meaning is in what version of Word the docx is created.

It is best if it is saved in Word 2013 without the so-called compatibility with previous versions. However, if this compatibility has been set, there are problems with the correct generation of pdf. Despite the settings according to the instructions below, it does not correctly recognize the number of nodes in the table.

Placing selected elements from the process in the document

From version 3.2.165 it is possible to place in the document detailed information about process comments, documents attached to the process and history of the process. Template should contain proper key corresponding to the form element that will be placed in the document. The following keys are available:


  • for comments from the process


keyelement

@activity.comment.author@

Author

@activity.comment.date@

Date

@activity.comment.activity_name@

Task name

@activity.comment.content@

Comments


  • for documents attached to the process

 

keyelement

@activity.document.name@

Document name

@activity.document.description@

Description

@activity.document.class_name@

Document class

@activity.document.date@

Date

@activity.document.uploader@

Owner

 

  • for process history

 

keyelement

@activity.history.name@

Task name

@activity.history.start_date@

Start date

@activity.history.finish_date@

End date

@activity.history.performer@

Operative

@activity.history.status@

Task status

 


Graphics placement in a dynamic table 

It is possible to place documents from the archive as a picture when generating a pdf from a template.

Graphic formats and PDFs are supported (the first page will be pasted as an image).

For documents that can not be inserted, a replacement graphic will be pasted.

To insert a graphic in the table, should be given a variable containing the File ID (FileID), NOT ID of the documentand use the special "I" tag (I like image).

Based on a variable in a given row, the system will download the appropriate document and place it in the table, matching the width of the column. If there is a text in the variable, not a number, it will remain in the given row. If the file does not exist on the system or can not be inserted as a graphic, a substitute graphic will be inserted. This will be a graphic showing the file type (if is supported) or a general graphic showing the lack of image.

It can be also used a tag in the format I (Width, Height),where width and height is an integer greater than 0. This is the same scale as the font size. This parameter scales the image to the given values while maintaining the aspect ratio. The image will be scaled so that one of the sides reach the maximum size given in the parameter. The image is scaled from the center of the cell. In the case of too large scaling, the image will be cut to the maximum page size (the image will not be divided into two pages). The pdf file will be increased by the original size of each graphic file placed in it. When graphics in the size of 4MB is included, the resulting file will have a size of 4MB + the size of this file without graphics.

Sample template

An example of a generated document based on this template

 

Paste several graphics into one cell.

From the system version ....  PWFL-5545 - Getting issue details... STATUS  it is possible to generate several pictures in one row. For this should be entered fileIdafter the comma eg 123,223,2434 and used the I tag.

For default tags (Width, Height), the next images will be placed one after one. For better configuration, third parameter "Maximum number of graphics per line"has been added. This parameter determines how many graphics should be displayed in a row. When the number of graphics is bigger, a break occurs and next graphics are inserted below (All in the same cell). Defaulty this parameter value is 1. For a value of 0, in a row displays as many graphics as it is. There is also the option of setting the I(,,X)tag, where Xis an integer greater than or equal to 0. This tag behaves the same as I, only the number of graphics can be determined. Between the graphics in the row a tab is placed to separate the graphics.

Sample template

Input data from the form

An example of a generated document based on this template

 

 

  • No labels