Plugin-Download (requires login)

The print service plugin has been changed to a new concept for technical reasons. For this, a separate print server must be installed in addition to the plugin. The usage and configuration of the plugin action does not differ between the old and the new version.

Hints for installation and special features of the old version as well as its download link can be found in the section Notes for older versions of the Print Service Plugin.

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.

Technical details

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 Xima® Formcycle master server.

Installation

The installation of the required Print Server requires different procedures depending on the operating system.

Installation Print Server on Windows

Installation of Node.js

1. Download the LTS version from https://nodejs.org/
2. Run the MSI file
3. Run the wizard steps, leaving default settings as they are

Installation steps for the Print Server

4. Download the Print Server installation files from the Customer Cloud here.
5. unzip the ZIP file "print_server_fc.zip" and move the content to the folder print_server_fc under C:\Programs\.

To install, open the command line (cmd) with administrative privileges and execute the following commands:

cd C:\Programs\print_server_fc
npm install
npm install -g node-windows
npm link node-windows
node install-windows-service.js

There now exists a new service FORMCYCLE Print Server. Please check if this is also started before you run a test. The script install-windows-service.js contains default variables for installing the print service.

  • The service is installed on port 8090 by default. To change this, you need to adjust the --port=8090 parameter in the install-windows-service.js file.
  • Logging is enabled by default. To change this set the parameter --verbose=true to --verbose=false.

After the installation, a folder named deamon is created for the log files.

Uninstall

Für die Deinstallation des Print Servers, öffnen Sie eine Kommandozeile (cmd) mit administrativen Berechtigungen und führen Sie folgende Befehle aus. 

cd C:\Programs\print_server_fc
node uninstall-windows-service.js

Installing Print Server under Linux

Installation steps for installing Node.js and the Print Server

To install, open the console and run the following commands:

# Loading the script (varies depending on the operating system)

#   Debian 10 - If you are logged in as root:
wget "https://customer.formcycle.eu/index.php/s/0GBtp1HtQHJMzQx/download?path=/&files=install_printserver_debian10.sh" -O install_print_server.sh

#   Debian 10 - or if you are logged in as a normal user with sudo rights:
wget "https://customer.formcycle.eu/index.php/s/0GBtp1HtQHJMzQx/download?path=/&files=install_printserver_debian10_sudo.sh" -O install_print_server.sh

#   Ubuntu 16 - If you are logged in as root:
wget "https://customer.formcycle.eu/index.php/s/0GBtp1HtQHJMzQx/download?path=/&files=install_printserver_ubuntu16.sh" -O install_print_server.sh


# Make file executable
chmod 750 install_print_server.sh


# Start installation
./install_print_server.sh


# Run Print Server
systemctl start printserver

In the first lines of the script - via the variables PRINTSERVER_USER and PRINTSERVER_USER_PWD - the user name/password to be created can be adjusted.
The verbose parameter can be used to enable/disable the log output. The scripts for the service should be located at /home/formcycle/print_server. In the start script the verbose parameter can be adjusted.

Translated with www.DeepL.com/Translator (free version)

Uninstall

To uninstall the Print Server, open a command line (cmd) with administrative privileges and execute the following commands: 

/home/formcycle/deinstall_printserver.sh

Caution:
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!

Test

To check if the installation was successful, the service can be called on the server for a test:
http://localhost:8090/pdf?orientation=landscape&format=A4&wait=false&marginTop=0mm&formURL=http://www.formcycle.de

Plugin setup

Print-Service Plugin Installation

In order for the plugin to be available in Xima® 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.

If the old version of the print service plugin (phantom plugin) was already installed, the following procedure is recommended for installation:

  • Disable the phantom plugin
  • Delete the phantom plugin
  • Upload new print service plugin
  • Proceed with the configuration

Plugin Configuration

After the plugin has been installed, the service URL must be adjusted. This is defined in the plugin via the mandatory parameter pdf.print.services.url.

If the installation was done on the same server as Xima® Formcycle, then specify localhost as the domain. If no changes have been made to the port, the setting 8090 is retained.

For example: http://localhost:8089/pdf

This completes the setup of the print service plugin and it is available as an action in the workflow processing.

Troubleshooting

Command npm install leads to timeout

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:

npm config set proxy http://proxy.domain:port
npm config set https-proxy https://proxy.domain:port

If user data is required:

npm config set proxy http://user:pass@proxy.domain:port
npm config set https-proxy https://user:pass@proxy.domain:port

More information can also be found here: http://www.fladi.de/2014/02/06/howto-npm-hinter-einem-proxy-verwenden/

Printing does not work

If printing via Xima® 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: http://localhost:<port>/formcycle

PDF is printed, but the message 404 appears

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.

Downloading Chromium fails

The following error message appears on the console after running "npm install":
Error: unable to verify the first certificate

The described steps are only a workaround and the environment variables should be set back to the default values after the successful installation!

PS C:\test> $env:NODE_TLS_REJECT_UNAUTHORIZED = 0
PS C:\test> npm set strict-ssl false 

Usage and options

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:

File name
File name of the created PDF document.
Print mode
Input elements as text: Input elements are converted into plain text fields and the form is adapted to the width of the page.
Print mode
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.
Zoom factor
Factory by which the form is scaled. Use this to magnify or scale down very large or very small forms.
User groups
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.
URL parameter
Additional URL parameters added to the URL used when opening the form with Selenium. You can use URL parameters to prefill form fields or access them from within JavaScript.

CSS-Anpassungen für Druckbild

Input elements

To optimize the form for printing, form elements of type input field, text area und select (Drop-Down) may be converted to plain text fields, if the print mode is set to Input elements as text.

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:

.print.XSpan {
 font-size: 18pt;
 font-family: serif;
}

To overwrite some properties of the default CSS shipped with Xima® Formcycle, use more specific selectors such as:

.xm-form .xm-content div.print.XSpan {
 font-size: 18pt;
 font-family: serif;
}

Most properties do not require this, however.

Enforce page break

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.

[xn=div2] {
 display: block !important;
 page-break-before: always;
}

Usage of other fonts

Technical requirements

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.

Inclusion via CSS

To include a font installed on the server for printing, it must be explicitly defined with a @media print query and set for use by the appropriate form elements. In the simplest case, this can look like the following example:

@media print {
    @font-face {
       font-family: 'DejaVu Sans';
       src: local('DejaVu Sans');
    }
    .xm-form.modern *, .modern .XPage * {
       font-family: "DejaVu Sans";
    }
}

Here it is especially important that the identifier entered at local() corresponds to the name of the font.

Legal notice

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. 

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.

Notes for older versions of the Print Service Plugin

The following notes refer to the old version of the Print Service Plugin, which is based on phantomJS.

Plugin-Download (requires login)

Please use plugin version 2.0.0 or above for Xima® Formcycle Version 6.

Installation

The plugin can be installed as client plugin or system plugin. Instructions for installing plugins can be found here.

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 Xima® Formcycle is installed. The operating system used is displayed on the Server information page.

Technical details

In technical terms, the conversion is done using Selenium and the driver phantomJS. The page format of the created PDF document is A4.

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

Copyright 2000-2024