Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Polish

Tutaj zostały zebrane wszelkie informacje dot. poprawnego szablonu w formacie DOCX na podstawie którego można wygenerować dokument PDF.

Info

Taki sam szablon obowiązuje niezależnie od sposobu uruchomienia generowania pdf.

Dokumentacja szablonu w Java API

Generowanie PDF - nadal obowiązująca jest znaczna część opisu dot. tworzenia szablonów na podstawie których są generowane pdf'y.

Uaktualniona dokumentacja

Szablon to plik zapisany w formacie DOCX umożliwiający generowanie dokumentu na jego podstawie. Szablon można dodać w administracji systemu: Administracja -> Obieg dokumentów -> Procesy -> (wybrać proces) -> Edycja -> Szablony dokumentów.

Info
 Wszelkie potrzebne informacje związane z umożliwieniem dodawania szablonów (np. tworzenie nowej klasy dokumentów ) zawarte są tutaj.

 

Typy generowania PDF

Info

Od wersji systemu 3.2.164 w parametrach systemowych można wybrać nowy typ generowania dokumentu pdf (Office). Parametr znajduje się w zakładce Dokumenty pod nazwą PdfConverter. Opis typów:

  • Standard - domyślny typ generowania dokumentów. Ten rodzaj generowania był wykorzystywany dotychczas i po aktualizacji wersji będzie nadal wykorzystywany.
  • Office - działa tylko na systemach, które uruchomione są pod systemem Windows i serwer ma zainstalowany pakiet Office 2010+ (licencja Offica musi być aktywna na użytkowniku, na którym zainstalowany jest system PlusWorkflow/Tomcat).

    Generowanie przy użyciu typu Office, eliminuje niektóre problemy, które pojawiają się przy próbach generowania metodą domyślną: 
    1) generuje znak wodny
    2) generuje tabelkę z dużą ilością wierszy (10 000+)
    3) poprawnie generuje style nałożone na tekst (indeks górny itp.)

 

Przykładowy szablon do zaprezentowania działania. Tabela dynamiczna została wyróżniona kolorem.

Szablon posłuży do wygenerowania dokumentu z powyższego formularza.
 
Wygenerowany dokument.

 

Tworzenie szablonu

Tworzenie szablonu należy zacząć od utworzenia pliku z rozszerzeniem .docx. W szablonie należy korzystać tylko z czcionek z rozszerzeniem ttf. Zmienne są uzupełniane na podstawie ich nazw w formularzu oraz muszą się znaleźć pomiędzy dwoma znacznikami '@'.

PRZYKŁAD
@kwota_brutto@ zostanie uzupełniona aktualną wartością zmiennej "kwota_brutto", która znajduje się na formularzu, w tym przypadku będzie to: 3000.

Pełna nazwa użytkownika (od wersji DO UZUPEŁNIENIA)

Istnieje możliwość pobrania imienia i nazwiska użytkownika, którego login mamy dostępny w kontekście formularza(lub dodaliśmy mapping o podanym kluczu).
Aby uzupełnić miejsce na formularzu pełną nazwą użytkownika, należy użyć frazy "@fullusername#zmienna_z_loginem@", gdzie "zmienna_z_loginem" to id zmiennej formularza/klucz mappingu, która przechowuje wartość loginu.
Ta fraza nie może być wykorzystana przy ustalaniu nagłówka kolumny przy pomocy "|". 

PRZYKŁAD

Na formularzu istnieje zmienna o id "uzytkownik", która przechowuje login interesującego nas użytkownika(np. jkowal). W przypadku wpisania w szablonie dokumentu frazy "@fullusername#uzytkownik@" generator dokumentu wyszuka
użytkownika o loginie jkowal i w to miejsce zostanie zwrócony pełna nazwa używkownika: "Jan Kowalski".

Tabele dynamiczne

Tabele dynamiczne są to tabele mogące zawierać różną ilość wierszy w zależności od ilości danych na formularzu. Funkcja automatycznie rozpozna, która utworzona na szablonie tabela jest dynamiczna, jeśli zostanie odpowiednio utworzona. 

Tabela dynamiczna powinna zawierać dwa wiersze. Pierwszy pełni rolę nagłówka, gdzie każda komórka powinna zawierać nazwę zmiennej umieszczoną pomiędzy dwoma znacznikami '@', np. @konto@. Nazwy zmiennych można zastąpić własnym tekstem poprzez umieszczenie znaku ' | ' pomiędzy nazwą zmiennej a wprowadzonym tekstem. Drugi wiesz powinien zostać wypełniony dużą literą 'T'. Jeżeli nagłówek tabeli ma zostać ukryty należy użyć litery 'H'. Dodanie tła w nagłówku tabeli ma na celu podkreślenie, iż jest to tabela dynamiczna. Formatowanie nie wpływa na działanie programu.

PRZYKŁAD

 

Przykładowo wypełniona tabelka dynamiczna w systemie.


Tabele dynamiczne w szablonie. Dolna tabela po wygenerowaniu nie będzie posiadać nagłówka.


Tabela dynamiczna wypełniona literą 'T' posiada nagłówek.

Tabela dynamiczna wypełniona literą 'H' jest pozbawiona nagłówka.
Info
titleZalecanym znacznikiem zmiennych jest znak @.

Od wersji 3.2.3 PlusWorkflow, może on być stosowany nawet wtedy jeśli jest używany w treści, nagłówku i stopce szablonu (poza oznaczaniem zmiennych) np. w adresie email. itp.
W zależności od sposobu uruchamiania generowania, nie można go zmienić, zmiana nie zapewnia poprawnego działania albo działa poprawnie także po zmianie.
We wcześniejszych wersjach konieczne było zastąpienie znaków @ w treści frazą: Xsuncode-atX lub użycie innego znacznika zmiennych, co nie dla wszystkich sposobów uruchomienia było możliwe lub nie działało poprawnie.

Info

Uwaga, znaczenie ma w jakiej wersji Worda jest tworzony docx.
Najlepiej jeśli jest zapisany w Word 2013 bez tzw zgodności do poprzednich wersji.
Natomiast jeśli została ustawiona ta zgodność to bywają problemy z poprawnym wygenerowaniem pdf. Pomimo ustawień zgodnie z poniższą instrukcją, nie rozpoznaje poprawnie liczby węzłów w tabeli

Info

Uwaga, jezeli tabelka nie generuje się lub zostaje ucięta podczas generowania należy sprawdzić czy checkbox "Zezwalaj na dzielenie wierszy między stronami" w właściwościach tabeli jest zaznaczony.

Image Added

Umieszczanie w dokumencie wybranych elementów z procesu

Od wersji 3.2.165 istnieje możliwość umieszczenia w dokumencie szczegółowych informacji na temat komentarzy z procesu, dokumentów podłączonych do procesu oraz historii procesu. W szablonie należy umieścić klucz odpowiadający elementowi formularza, który zostanie umieszczony w dokumencie. Dostępne są następujące klucze:

 

  • dla komentarzy z procesu


kluczelement

@process.comment.author@

Autor

@process.comment.date@

Data

@process.comment.activity_name@

Nazwa zadania

@process.comment.content@

Komentarz

 

 

  • dla dokumentów podłączonych do procesu


 

 

  • dla historii procesu


kluczelement

@activity.history.name

Nazwa zadania
@activity.history.start_date@Data rozpoczęcia

@activity.history.finish_date@

Data zakończenia
@activity.history.performer@Wykonawca
@activity.history.status@Status zadania


Osadzanie grafiki w tabeli dynamicznej

Istnieje możliwość umieszczania dokumentów z archiwum jako obrazka podczas generowania pdf'a z szablonu.
Obsługiwane są formaty graficzne i PDFy (pierwsza strona zostanie wklejona jako obraz).

Dla dokumentów które nie da się wstawić zostanie wklejona grafika zastępcza.

Aby wstawić grafikę w tabelce należy podać zmienną zawierającą ID Pliku (FileID), NIE ID dokumentu . i użyć specjalnego znacznika "I" (i jak image).

System na podstawie zmiennej w danym wierszu pobierze odpowiedni dokument i umieści go w tabelce dopasowując do szerokości kolumny. Gdy w zmiennej znajduje się tekst a nie liczba, pozostanie on w danym wierszu. Jeżeli plik nie istnieje w systemie lub nie da się go wstawić jako grafikę zostanie wstawiona grafika zastępcza. Będzie to grafika pokazująca typ pliku (jeżeli jest obsługiwany) lub grafika ogólna pokazująca brak obrazka.

Można użyć też znacznika w formacie I(Szerokość,Wysokość), gdzie szerokość i wysokość to liczba całkowita większa od 0. Jest to skala taka sama jak wielkość czcionki. Parametr ten skaluję obrazek do podanych wartości przy zachowaniu proporcji. Obrazek będzie tak skalowany aż któryś z boków nie osiągnie maksymalnej wielkości podanej w parametrze. Obrazek jest skalowany od środka komórki. W przypadku za dużego skalowania obraz będzie przycięty do maksymalnie wymiarów strony (Obraz nie będzie podzielony na dwie strony). Plik w formacie pdf zostanie zwiększony o oryginalną wielkość każdego pliku graficznego w nim umieszczonego. Gdy załączymy grafikę w wielkości 4MB to plik wynikowy będzie miał rozmiar 4MB + rozmiar tego pliku bez grafiki.

Przykładowy szablon

Przykładowy wygenerowany dokument na podstawie tego szablonu

 

Wklejanie kilku grafik do jednej komórki.

Od wersji systemu....

JIRA
server192.168.1.52 JIRA
columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
serverId2e6b42a8-62e1-3c71-bfe9-dbf183b33dc1
keyPWFL-5545
 istnieje możliwość wygenerowania kilku obrazków w jednym wierszu. W tym celu należy podać fileId po przecinku np 123,234,2434 i zastosować znacznik I.

Dla domyślnych znaczników  I(Szerokość,Wysokość), kolejne grafiki będą umieszczane jeden po drugim. Dla lepszej konfiguracji został dodany 3 parametr "Maksymalna ilość grafik w wierszu" . Parametr ten określa ile maksymalnie grafik ma być wyświetlone w rzędzie. Gdy liczba grafik jest większa to następuje załamanie i kolejne grafiki wstawiane są poniżej (Wszystko w  tej samej komórce). Domyślnie wartość tego parametru wynosi 1. Dla wartości 0 w rzędzie wyświetla się tyle grafik ile jest.  Istnieję też możliwość ustawienia znacznik I(,,X)  gdzie X jest liczbą całkowitą większą lub równą 0. Ten znacznik zachowuję się tak samo jak I, tylko można określić ilość grafik. Pomiędzy grafikami w rzędzie jest stawiony tabulator w celu odseparowania grafik.

Przykładowy szablon

Dane wejściowe z formularza

Przykładowy wygenerowany dokument na podstawie tego szablonu

English

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.

Info

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.

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

 

PDF generation types

Info

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.
Info
titleThe 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.

Info

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

  • 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 .... 

JIRA
server192.168.1.52 JIRA
columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
serverId2e6b42a8-62e1-3c71-bfe9-dbf183b33dc1
keyPWFL-5545
 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

 

...