Changes for page Print-Service-Plugin


From version 2.1
edited by gru
on 04.03.2021, 10:12
Change comment: Imported from XAR
To version 4.1
edited by gru
on 02.09.2021, 08:01
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,9 +1,5 @@
1 -[[**Plugin download**>>url:https://customer.formcycle.eu/index.php/apps/files/?dir=/FORMCYCLE%20-%20Plugins%20Customer/plugin-bundle-phantomjs&fileid=342||target="_blank"]] (requires login)
1 +[[**Plugin-Download**>>url:https://customer.formcycle.eu/index.php/apps/files/?dir=/FORMCYCLE%20-%20Plugins%20Customer/fc-plugin-print-service&fileid=8194||rel="noopener noreferrer" target="_blank"]] (requires login)
2 2  
3 -{{info}}
4 -Please use **plugin version 2.0.0** or above for {{formcycle/}} Version 6.
5 -{{/info}}
6 -
7 7  {{content/}}
8 8  
9 9  The plugin //Print Services// is available separately and lets you create a PDF document from a form that is optimized for printing. This plugin is subject to additional charge.
... ... @@ -10,18 +10,170 @@
10 10  
11 11  == Technical details ==
12 12  
13 -In technical terms, the conversion is done using Selenium and the driver //phantomJS//. The page format of the created PDF document is A4.
9 +To use the //Print-Service// plugin, it is necessary to install //Node.js// and the //Print Server//. This can be installed on the same server as the {{formcycle/}} master server.
14 14  
15 -{{warning}}
16 -When you print a form with the print services, JavaScript defined for the form is executed. However, please note that no newer JavaScript features are supported. Specifically, no features from {{smallcaps}}Ecma{{/smallcaps}}Script6 and higher are available. This that, for example, you cannot use new keywords such as //let// and //const// or new syntax such as arrow functions or destructuring.
17 -{{/warning}}
18 -
19 19  == Installation ==
20 20  
21 -The plugin can be installed as client plugin or system plugin. Instructions for installing plugins can be found [[here>>doc:Formcycle.UserInterface.Client.Plugins.WebHome]].
13 +The installation of the required //Print Server// requires different procedures depending on the operating system.
22 22  
23 -{{info}}There are several versions of the Print PDF plugin for different operating systems (//32-bit Linux//, //64-bit Linux//, //Windows//, //MacOSX//). It is only necessary to install the version of the plugin that corresponds to the operating system on which {{formcycle /}} is installed. The operating system used is displayed on the [[Server information>>Formcycle.SystemSettings.UserInterface.ServerInformation]] page.{{/info}}
15 +=== Installation Print Server on Windows ===
24 24  
17 +==== Installation of Node.js ====
18 +
19 +: 1. Download the LTS version from https://nodejs.org/
20 +: 2. Run the MSI file
21 +: 3. Run the wizard steps, leaving default settings as they are
22 +
23 +==== Installation steps for the Print Server ====
24 +
25 +: 4. Download the Print Server installation files from the Customer Cloud [[here>>https://customer.formcycle.eu/index.php/apps/files/?dir=/FORMCYCLE%20-%20Plugins%20Customer/fc-plugin-print-service/Print%20Server&fileid=18856]].
26 +: 5. unzip the ZIP file "print_server_fc.zip" and move the content to the folder print_server_fc under {{code language="none"}}C:\Programs\{{/code}}.
27 +
28 +To install, open the command line (cmd) with administrative privileges and execute the following commands:
29 +
30 +{{code language="none"}}
31 +cd C:\Programs\print_server_fc
32 +npm install
33 +npm install -g node-windows
34 +npm link node-windows
35 +node install-windows-service.js
36 +{{/code}}
37 +
38 +There now exists a new service {{code language="none"}}FORMCYCLE Print Server{{/code}}. Please check if this is also started before you run a [[test>>||anchor="HTest"]]. The script {{code language="none"}}install-windows-service.js{{/code}} contains default variables for installing the print service.
39 +
40 +* The service is installed on port 8090 by default. To change this, you need to adjust the {{code language="none"}}--port=8090{{/code}} parameter in the {{code language="none"}}install-windows-service.js{{/code}} file.
41 +* Logging is enabled by default. To change this set the parameter {{code language="none"}}--verbose=true{{/code}} to {{code language="none"}}--verbose=false{{/code}}.
42 +
43 +After the installation, a folder named {{code language="none"}}deamon{{/code}} is created for the log files.
44 +
45 +==== Uninstall ====
46 +
47 +Für die Deinstallation des Print Servers, öffnen Sie eine Kommandozeile (cmd) mit administrativen Berechtigungen und führen Sie folgende Befehle aus.
48 +
49 +{{code language="none"}}
50 +cd C:\Programs\print_server_fc
51 +node uninstall-windows-service.js
52 +{{/code}}
53 +
54 +
55 +=== Installing Print Server under Linux ===
56 +
57 +==== Installation steps for installing Node.js and the Print Server ====
58 +
59 +To install, open the console and run the following commands:
60 +
61 +{{code language="none"}}
62 +# Loading the script (varies depending on the operating system)
63 +
64 +# Debian 10 - If you are logged in as root:
65 +wget "https://customer.formcycle.eu/index.php/s/0GBtp1HtQHJMzQx/download?path=/&files=install_printserver_debian10.sh" -O install_print_server.sh
66 +
67 +# Debian 10 - or if you are logged in as a normal user with sudo rights:
68 +wget "https://customer.formcycle.eu/index.php/s/0GBtp1HtQHJMzQx/download?path=/&files=install_printserver_debian10_sudo.sh" -O install_print_server.sh
69 +
70 +# Ubuntu 16 - If you are logged in as root:
71 +wget "https://customer.formcycle.eu/index.php/s/0GBtp1HtQHJMzQx/download?path=/&files=install_printserver_ubuntu16.sh" -O install_print_server.sh
72 +
73 +
74 +# Make file executable
75 +chmod 750 install_print_server.sh
76 +
77 +
78 +# Start installation
79 +./install_print_server.sh
80 +
81 +
82 +# Run Print Server
83 +systemctl start printserver
84 +{{/code}}
85 +
86 +In the first lines of the script - via the variables {{code language="none"}}PRINTSERVER_USER{{/code}} and {{code language="none"}}PRINTSERVER_USER_PWD{{/code}} - the user name/password to be created can be adjusted.
87 +The verbose parameter can be used to enable/disable the log output. The scripts for the service should be located at {{code language="none"}}/home/formcycle/print_server{{/code}}. In the start script the verbose parameter can be adjusted.
88 +
89 +Translated with www.DeepL.com/Translator (free version)
90 +
91 +==== Uninstall ====
92 +
93 +To uninstall the Print Server, open a command line (cmd) with administrative privileges and execute the following commands:
94 +
95 +{{code language="none"}}
96 +/home/formcycle/deinstall_printserver.sh
97 +{{/code}}
98 +
99 +{{info}}
100 +**Caution:**
101 +During the installation, depending on the existing system, some Linux packages such as nodejs were also installed. However, it is not possible to uninstall the packages automatically. Delete the automatically installed packages only if you are 100% sure that they are no longer needed!
102 +{{/info}}
103 +
104 +=== Test ===
105 +
106 +To check if the installation was successful, the service can be called on the server for a test:
107 +{{code language="none"}}http://localhost:8090/pdf?orientation=landscape&format=A4&wait=false&marginTop=0mm&formURL=http://www.formcycle.de{{/code}}
108 +
109 +=== Plugin setup ===
110 +
111 +==== Print-Service Plugin Installation ====
112 +
113 +In order for the plugin to be available in {{formcycle/}} as an action in the workflow processing, it must be deployed in the System Plugin section of the management interface. Instructions for installing plugins can be found [[here>>doc:Formcycle.UserInterface.Client.Plugins.WebHome]].
114 +
115 +If the old version of the print service plugin (phantom plugin) was already installed, the following procedure is recommended for installation:
116 +* Disable the phantom plugin
117 +* Delete the phantom plugin
118 +* Upload new print service plugin
119 +* Proceed with the configuration
120 +
121 +==== Plugin Configuration ====
122 +
123 +After the plugin has been installed, the service URL must be adjusted. This is defined in the plugin via the mandatory parameter {{code language="none"}}pdf.print.services.url{{/code}}.
124 +
125 +If the installation was done on the same server as {{formcycle/}}, then specify {{code language="none"}}localhost{{/code}} as the domain. If no changes have been made to the port, the setting {{code language="none"}}8090{{/code}} is retained.
126 +
127 +For example: {{code language="none"}}http://localhost:8089/pdf{{/code}}
128 +
129 +This completes the setup of the print service plugin and it is available as an action in the [[workflow processing>>doc:Formcycle.UserInterface.MyForms.WorkflowProcessing]].
130 +
131 +=== Troubleshooting ===
132 +
133 +==== Command npm install leads to timeout ====
134 +
135 +If the npm install command does not work due to a proxy, then the general proxy setting is not sufficient. Therefore, the following must be executed via console:
136 +
137 +{{code language="none"}}
138 +npm config set proxy http://proxy.domain:port
139 +npm config set https-proxy https://proxy.domain:port
140 +{{/code}}
141 +
142 +If user data is required:
143 +
144 +{{code language="none"}}
145 +npm config set proxy http://user:pass@proxy.domain:port
146 +npm config set https-proxy https://user:pass@proxy.domain:port
147 +{{/code}}
148 +
149 +More information can also be found here: http://www.fladi.de/2014/02/06/howto-npm-hinter-einem-proxy-verwenden/
150 +
151 +==== Printing does not work ====
152 +
153 +If printing via {{formcycle/}} is not possible, the cause could be that the print service is not reachable. This can be solved by the loopback URL. Under System > General > Loopback URL, loopback base URL: {{code language="none"}}http://localhost:<port>/formcycle{{/code}}
154 +
155 +==== PDF is printed, but the message 404 appears ====
156 +
157 +In this case the print service works correctly because a PDF is already created. It must be checked whether the loopback URL is entered correctly so that the URL to the print service is resolved correctly.
158 +
159 +==== Downloading Chromium fails ====
160 +
161 +The following error message appears on the console after running "npm install":
162 +{{code language="none"}}
163 +Error: unable to verify the first certificate
164 +{{/code}}
165 +
166 +The described steps are only a workaround and the environment variables should be set back to the default values after the successful installation!
167 +
168 +{{code language="none"}}
169 +PS C:\test> $env:NODE_TLS_REJECT_UNAUTHORIZED = 0
170 +PS C:\test> npm set strict-ssl false
171 +{{/code}}
172 +
25 25  == Usage and options ==
26 26  
27 27  To use this plugin, go to the workflow processing configuration, click on new action and select this plugin. The following options are used to configure the plugin action:
... ... @@ -39,7 +39,8 @@
39 39  ; **URL parameter**
40 40  : Additional URL parameters added to the URL used when opening the form with Selenium. You can use URL parameters to [[prefill form fields>>Formcycle.FormDesigner.URLParameter]] or access them from within JavaScript.
41 41  
42 -== Input elements ==
190 +== CSS-Anpassungen für Druckbild ==
191 +=== Input elements ===
43 43  
44 44  To optimize the form for printing, form elements of type [[input field>>Formcycle.FormDesigner.FormElements.Input]], [[text area>>Formcycle.FormDesigner.FormElements.Textarea]] und [[select>>Formcycle.FormDesigner.FormElements.Selection]] (Drop-Down) may be converted to plain text fields, if the print mode is set to Input elements as text.
45 45  
... ... @@ -55,7 +55,7 @@
55 55  To overwrite some properties of the default CSS shipped with {{formcycle/}}, use more specific selectors such as:
56 56  
57 57  {{code language="css"}}
58 -xm-form .xm-content div.print.XSpan {
207 +.xm-form .xm-content div.print.XSpan {
59 59   font-size: 18pt;
60 60   font-family: serif;
61 61  }
... ... @@ -62,3 +62,44 @@
62 62  {{/code}}
63 63  
64 64  Most properties do not require this, however.
214 +
215 +=== Enforce page break ===
216 +
217 +To create a defined page break, the page-break attributes must be set via CSS. The corresponding container or element has to be selected via the xn attribute. Please note that the CSS property //display //must be set to //block//, otherwise no line break will be created. In this example, a line break should be created before the container //div1//.
218 +
219 +{{code language="css"}}
220 +[xn=div2] {
221 + display: block !important;
222 + page-break-before: always;
223 +}
224 +{{/code}}
225 +
226 +=== Usage of other fonts ===
227 +
228 +==== Technical requirements ====
229 +
230 +In order for fonts to be used and embedded in the created PDF documents, it is generally necessary for them to be installed on the server running the Print-Server.
231 +
232 +==== Inclusion via CSS ====
233 +
234 +To include a font installed on the server for printing, it must be explicitly defined with a {{code language="none"}}@media print{{/code}} query and set for use by the appropriate form elements. In the simplest case, this can look like the following example:
235 +
236 +{{code language="css"}}
237 +@media print {
238 + @font-face {
239 + font-family: 'DejaVu Sans';
240 + src: local('DejaVu Sans');
241 + }
242 + .xm-form.modern *, .modern .XPage * {
243 + font-family: "DejaVu Sans";
244 + }
245 +}
246 +{{/code}}
247 +
248 +Here it is especially important that the identifier entered at {{code language="none"}}local(){{/code}} corresponds to the name of the font.
249 +
250 +==== Legal notice ====
251 +
252 +Fonts sometimes have very tightly defined license terms and are priced differently depending on their intended use. It should be noted that fonts for creating PDFs must be embedded in them, which for many commercial fonts requires a different license than for delivery via a web server for the purpose of displaying a web page in a web browser.
253 +
254 +In fonts of type //TrueType// and //OpenType// information about the embeddability of the font can be stored directly. Depending on what is configured there, a font may not be embeddable and will instead be rendered by the //Print-Service-Plugin// only as a vector graphic in the created PDF documents.