Changes for page Print-Service-Plugin


From version 9.1
edited by awa
on 13.06.2022, 18:29
Change comment: There is no comment for this version
To version 1.1
edited by gru
on 20.01.2021, 16:20
Change comment: Imported from XAR

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.awa
1 +XWiki.gru
Content
... ... @@ -1,211 +1,48 @@
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)
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)
2 2  
3 3  {{info}}
4 -{{formcycle/}} Version 7 requires the //Print-Service// plugin version to be **4.0.0** or higher.
4 +Please use **plugin version 2.0.0** or above for {{formcycle/}} Version 6.
5 5  {{/info}}
6 6  
7 7  {{content/}}
8 8  
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.
9 +The plugin //Print Services// is available separately and lets you create a PDF document from a form that is optimized for printing.
10 10  
11 11  == Technical details ==
12 12  
13 -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.
13 +In technical terms, the conversion is done using Selenium and the driver //phantomJS//. The page format of the created PDF document is A4.
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 +
15 15  == Installation ==
16 16  
17 -The installation of the required //Print Server// requires different procedures depending on the operating system.
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]].
18 18  
19 -=== Installation Print Server on Windows ===
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}}
20 20  
21 -==== Installation of Node.js ====
22 -
23 -: 1. Download the LTS version from https://nodejs.org/
24 -: 2. Run the MSI file
25 -: 3. Run the wizard steps, leaving default settings as they are
26 -
27 -==== Installation steps for the Print Server ====
28 -
29 -: 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]].
30 -: 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}}.
31 -
32 -To install, open the command line (cmd) with administrative privileges and execute the following commands:
33 -
34 -{{code language="none"}}
35 -cd C:\Programs\print_server_fc
36 -npm install
37 -npm install -g node-windows
38 -npm link node-windows
39 -node install-windows-service.js
40 -{{/code}}
41 -
42 -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.
43 -
44 -* 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.
45 -* Logging is enabled by default. To change this set the parameter {{code language="none"}}--verbose=true{{/code}} to {{code language="none"}}--verbose=false{{/code}}.
46 -
47 -After the installation, a folder named {{code language="none"}}deamon{{/code}} is created for the log files.
48 -
49 -==== Uninstall ====
50 -
51 -Für die Deinstallation des Print Servers, öffnen Sie eine Kommandozeile (cmd) mit administrativen Berechtigungen und führen Sie folgende Befehle aus.
52 -
53 -{{code language="none"}}
54 -cd C:\Programs\print_server_fc
55 -node uninstall-windows-service.js
56 -{{/code}}
57 -
58 -
59 -=== Installing Print Server under Linux ===
60 -
61 -==== Installation steps for installing Node.js and the Print Server ====
62 -
63 -To install, open the console and run the following commands:
64 -
65 -{{code language="none"}}
66 -# Loading the script (varies depending on the operating system)
67 -
68 -# Debian 10 - If you are logged in as root:
69 -wget "https://customer.formcycle.eu/index.php/s/0GBtp1HtQHJMzQx/download?path=/&files=install_printserver_debian10.sh" -O install_print_server.sh
70 -
71 -# Debian 10 - or if you are logged in as a normal user with sudo rights:
72 -wget "https://customer.formcycle.eu/index.php/s/0GBtp1HtQHJMzQx/download?path=/&files=install_printserver_debian10_sudo.sh" -O install_print_server.sh
73 -
74 -# Ubuntu 16 - If you are logged in as root:
75 -wget "https://customer.formcycle.eu/index.php/s/0GBtp1HtQHJMzQx/download?path=/&files=install_printserver_ubuntu16.sh" -O install_print_server.sh
76 -
77 -
78 -# Make file executable
79 -chmod 750 install_print_server.sh
80 -
81 -
82 -# Start installation
83 -./install_print_server.sh
84 -
85 -
86 -# Run Print Server
87 -systemctl start printserver
88 -{{/code}}
89 -
90 -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.
91 -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.
92 -
93 -Translated with www.DeepL.com/Translator (free version)
94 -
95 -=== Uninstall ===
96 -
97 -To uninstall the Print Server, open a command line (cmd) with administrative privileges and execute the following commands:
98 -
99 -{{code language="none"}}
100 -/home/formcycle/deinstall_printserver.sh
101 -{{/code}}
102 -
103 -{{info}}
104 -**Caution:**
105 -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!
106 -{{/info}}
107 -
108 -=== Test ===
109 -
110 -To check if the installation was successful, the service can be called on the server for a test:
111 -{{code language="none"}}http://localhost:8090/pdf?orientation=landscape&format=A4&wait=false&marginTop=0mm&formURL=http://www.formcycle.de{{/code}}
112 -
113 -=== Plugin setup ===
114 -
115 -==== Print-Service Plugin Installation ====
116 -
117 -In order for the plugin to be available in {{formcycle/}} as an action in the workflow, 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]].
118 -
119 -If the old version of the print service plugin (phantom plugin) was already installed, the following procedure is recommended for installation:
120 -
121 -* Disable the phantom plugin
122 -* Delete the phantom plugin
123 -* Upload new print service plugin
124 -* Proceed with the configuration
125 -
126 -==== Plugin Configuration ====
127 -
128 -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}}.
129 -
130 -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.
131 -
132 -For example: {{code language="none"}}http://localhost:8089/pdf{{/code}}
133 -
134 -This completes the setup of the print service plugin and it is available as an action in the [[workflow processing>>doc:Formcycle.Designer.Workflow.WebHome]].
135 -
136 -== Troubleshooting ==
137 -
138 -=== Command npm not found ===
139 -
140 -Under Windows it is possible that after the NodeJS installation the environment variables are not set correctly and so npm install cannot be executed. This was also the case if the default path under C:/Programs was not used during the NodeJS installation. So check in the path if these are existing. The following must be done for this:
141 -
142 -* Call up the environment variables via Control Panel > System > Advanced System Settings > Environment Variables button.
143 -* In Path you should find the following entries: {{info}}C:\Users\{username}\AppData\Roaming\npm;C:\Program Files\nodejs{{/info}}
144 -* Confirm everything with Ok. The console then be opened again with admin rights.
145 -
146 -=== Command npm install leads to timeout ===
147 -
148 -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:
149 -
150 -{{code language="none"}}
151 -npm config set proxy http://proxy.domain:port
152 -npm config set https-proxy https://proxy.domain:port
153 -{{/code}}
154 -
155 -If user data is required:
156 -
157 -{{code language="none"}}
158 -npm config set proxy http://user:pass@proxy.domain:port
159 -npm config set https-proxy https://user:pass@proxy.domain:port
160 -{{/code}}
161 -
162 -More information can also be found here: http://www.fladi.de/2014/02/06/howto-npm-hinter-einem-proxy-verwenden/
163 -
164 -=== Printing does not work ===
165 -
166 -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}}
167 -
168 -=== PDF is printed, but the message 404 appears ===
169 -
170 -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.
171 -
172 -=== Downloading Chromium fails ===
173 -
174 -The following error message appears on the console after running "npm install":
175 -{{code language="none"}}Error: unable to verify the first certificate{{/code}}
176 -
177 -The described steps are only a workaround and the environment variables should be set back to the default values after the successful installation!
178 -
179 -{{code language="none"}}
180 -PS C:\test> $env:NODE_TLS_REJECT_UNAUTHORIZED = 0
181 -PS C:\test> npm set strict-ssl false
182 -{{/code}}
183 -
184 184  == Usage and options ==
185 185  
186 186  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:
187 187  
188 -; File name
29 +; **File name**
189 189  : File name of the created PDF document.
190 -; Print mode
31 +; **Print mode**
191 191  : Input elements as text: Input elements are converted into plain text fields and the form is adapted to the width of the page.
192 -; Print mode
193 -: By default, are form fields such as input fields and select fields are converted to plain text. If you choose to disable this conversion, no changes are made to the form and it is printed so that it looks as closely as it does in a web browser as possible.
194 -; Zoom factor
195 -: Scale factor for the form. Use this to magnify or scale down very large or very small forms.
196 -; Blank form
197 -: Can be used to create PDF documents that can be printed out and filled out manually with a pen. When enabled, all form field values are cleared and all hidden fields are shown. In addition, the maximum number of element repetitions are created.
198 -; User groups
33 +; **Print mode**
34 +: Web view: No changes are made to the form and it is converted so that it looks as closely as it does in a web browser as possible.
35 +; **Zoom factor**
36 +: Factory by which the form is scaled. Use this to magnify or scale down very large or very small forms.
37 +; **User groups**
199 199  : A virtual user is created when opening the form with Selenium. Select the user groups here to which this virtual user should belong to. Form elements can be configured to be displayed or editable only for certain user groups.
200 -; URL parameter
201 -: Additional URL parameters added to the URL used when opening the form with Selenium. You can use URL parameters to [[prefill form fields>>Formcycle.Designer.Form.URLParameter]] or access them from within JavaScript.
39 +; **URL parameter**
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.
202 202  
203 -== CSS-Anpassungen für Druckbild ==
42 +== Input elements ==
204 204  
205 -=== Input elements ===
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.
206 206  
207 -To optimize the form for printing, form elements of type [[input field>>Formcycle.Designer.Form.FormElements.Input]], [[text area>>Formcycle.Designer.Form.FormElements.Textarea]] und [[select>>Formcycle.Designer.Form.FormElements.Selection]] (Drop-Down) may be converted to plain text fields, if the print mode is set to Input elements as text.
208 -
209 209  Additionally, the CSS classes //print// and //XSpan// are added to the converted input element that can be used for styling them. For example, in order to change the font size, you can use the following CSS:
210 210  
211 211  {{code language="css"}}
... ... @@ -218,7 +218,7 @@
218 218  To overwrite some properties of the default CSS shipped with {{formcycle/}}, use more specific selectors such as:
219 219  
220 220  {{code language="css"}}
221 -.xm-form .xm-content div.print.XSpan {
58 +xm-form .xm-content div.print.XSpan {
222 222   font-size: 18pt;
223 223   font-family: serif;
224 224  }
... ... @@ -225,67 +225,3 @@
225 225  {{/code}}
226 226  
227 227  Most properties do not require this, however.
228 -
229 -=== Enforce page break ===
230 -
231 -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//.
232 -
233 -{{code language="css"}}
234 -[xn=div2] {
235 - display: block !important;
236 - page-break-before: always;
237 -}
238 -{{/code}}
239 -
240 -=== Avoid page break ===
241 -
242 -The default setting for printing is that a page break is inserted after each page of the form:
243 -
244 -{{code language="css"}}
245 -@media print {
246 - .CXPage:not(:first-child ), .page-break {
247 - display: block !important;
248 - page-break-before: always;
249 - }
250 -}
251 -{{/code}}
252 -
253 -In order to avoid breaks, the following rule needs to be defined in the CSS tab of the form:
254 -
255 -{{code language="css"}}
256 -@media print {
257 - .CXPage:not(:first-child ) {
258 - page-break-before: avoid;
259 - }
260 -}
261 -{{/code}}
262 -
263 -=== Usage of other fonts ===
264 -
265 -==== Technical requirements ====
266 -
267 -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.
268 -
269 -==== Inclusion via CSS ====
270 -
271 -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:
272 -
273 -{{code language="css"}}
274 -@media print {
275 - @font-face {
276 - font-family: 'DejaVu Sans';
277 - src: local('DejaVu Sans');
278 - }
279 - .xm-form.modern *, .modern .XPage * {
280 - font-family: "DejaVu Sans";
281 - }
282 -}
283 -{{/code}}
284 -
285 -Here it is especially important that the identifier entered at {{code language="none"}}local(){{/code}} corresponds to the name of the font.
286 -
287 -==== Legal notice ====
288 -
289 -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.
290 -
291 -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.