Enabling PDF Conversion
PDF conversion commands are specified in the PDF Conversion Command and PDF Conversion Command for Mass Printing settings at System > Settings > Notifications > PDF Conversion Settings. These settings are not editable in the UI due to security reasons and have the following values:
-
PDF Conversion Command:
/usr/local/bm/bin/pdfconversion.sh "@@SrcName@" "@@DstName@"
-
PDF Conversion Command for Mass Printing:
/usr/local/bm/bin/pdfmassconversion.sh "@@SrcName@" "@@DstName@"
By default, the pdfconversion.sh
and pdfmassconversion.sh
scripts use the wkhtmltopdf PDF conversion tool, which is run with this command:
wkhtmltopdf --disable-javascript --header-left [section] --header-font-size 8 --header-right "Page [page] of [toPage]" --page-size A4 --orientation portrait --encoding utf-8 -B 5 -L 5 -R 5 -T 5 $SrcName $DstName
If this default configuration does not meet your requirements, you have the following options to adjust how PDF conversion is performed and which PDF conversion tools are used:
Option 1: Use a Custom PDF Conversion Tool Placed on the Persistent Volume of the BSS Component
-
Prepare a custom PDF conversion tool. In this example, we will use a binary file named
customconverter
. -
Prepare new scripts
pdfconversion.sh
andpdfmassconversion.sh
, where each script invokescustomconverter
with the required parameters. For example:#!/bin/sh SrcName="$1" DstName="$2" customconverter -parameter value $SrcName $DstName
-
Place
customconverter
,pdfconversion.sh
, andpdfmassconversion.sh
to the /k8s_data/customization_bin directory of the conf-volume persistent volume used by the BSS component. For example:export NS=NAMESPACE_OF_YOUR_CBC_INSTALLATION bss_worker=`kubectl get pod -l stellart=worker -n $NS -o name | head -1 | sed -e 's#pod/##'` kubectl cp pdfconversion.sh $bss_worker:/k8s_data/customization_bin/ -n $NS kubectl cp pdfmassconversion.sh $bss_worker:/k8s_data/customization_bin/ -n $NS kubectl cp customconverter $bss_worker:/k8s_data/customization_bin/ -n $NS
-
Recreate the pods of the BSS component. For example:
kubectl delete pod -l app=bss -n $NS
As a result, the BSS component will start using the new configuration for PDF conversion.
Important: When placing the binaries of a custom PDF converter tool on the persistent volume, you must take into account all necessary libraries of those binaries and their compatibility with the OS of the images used by the BSS component.
Option 2: Use a Standalone PDF Conversion Service
-
Prepare the API URL and credentials of a standalone PDF conversion service. For instance, you can use an online service such as Pdfcrowd, or a service deployed on a server or in a Kubernetes cluster located in your data center.
-
Make sure the API of the service is accessible from your Kubernetes cluster.
-
Prepare new scripts
pdfconversion.sh
andpdfmassconversion.sh
, where each script makes calls to the API of the service with the required parameters. For example:#!/bin/sh SrcName="$1" DstName="$2" curl -f -u demo:ce544b6ea52a5621fb9d55f8b542d14d -o $DstName -F "file=@$SrcName" https://api.pdfcrowd.com/convert/
-
Place your
pdfconversion.sh
andpdfmassconversion.sh
to the /k8s_data/customization_bin directory of the conf-volume persistent volume used by the BSS component. For example:export NS=NAMESPACE_OF_YOUR_CBC_INSTALLATION bss_worker=`kubectl get pod -l stellart=worker -n $NS -o name | head -1 | sed -e 's#pod/##'` kubectl cp pdfconversion.sh $bss_worker:/k8s_data/customization_bin/ -n $NS kubectl cp pdfmassconversion.sh $bss_worker:/k8s_data/customization_bin/ -n $NS
-
Recreate the pods of the BSS component. For example:
kubectl delete pod -l app=bss -n $NS
As a result, the BSS component will start using the new configuration for PDF conversion.
Important: When using a standalone PDF conversion service, make sure that all items of HTML files of your documents such as images, styles, and scripts are either included in those HTML files or are accessible from that service.