Questions and discussion about using ProcessMaker: user interface, running cases & functionality

Moderator: amosbatto

By zainab
I am not sure about the exact change required to reduce the paragraph spacing, but you can have a look at the source code of tcpdf, where the structure of tcpdf is defined.
The files related to tcpdf is located in the following directory:
Code: Select all
Hope this helps.
Edit the HTML code for your Output Document template and add this code to the top:
Code: Select all
<style type="text/css">
p {
    margin: 0;
If that doesn't work, then change each of your <p> tags to <p style="margin:0; padding:0">
By nobody
If that still does not work (it did not for me) add these lines to the outputdocument.php, located e.g. at opt/processmaker/workflow/engine/classes
Code: Select all
$tagvs = array(
 'p' => array(0 => array('n' => 0, 'h' => ''), 1 => array('n' => 0, 'h' => ''))
This will definitelly help, though this will change the behaviour for all generated output documents.
If that is not what you want, than add this to the outputdocument.php
Code: Select all
$suppressLines =  $aFields['suppressLines'];
echo ($suppressLines);
if (isset ($suppressLines) && $suppressLines == "Yes") {
 $tagvs = array(
 'p' => array(0 => array('n' => 0, 'h' => ''), 1 => array('n' => 0, 'h' => ''))
The second solution allows you to define (e.g. in a trigger) whether you want to suppress the additional lines in the tcPDF or not. For this second method to work, it is necessary to create a variable in your process (e.g. suppresslines) and run a trigger that fires before the output document step/task (e.g. at the start of the case).
The trigger can be very simple, one line of code, such as
Code: Select all
@@suppressLines = "Yes";
That's a nice solution to the problem. I'm impressed that you dug through the code to find it.
By nobody
Thank you Amos. I also find the tcPdf code cumbersome, but still, it is a great tool if treated carefully. I try not to touch anything generic in tcpdf.php (such as paths, constants...) and I only use the outputdocument.php code to pass variables to tcpdf.php that are already defined therein. Otherwise, I always ended up with errors or malfunction.

This way, I was able to make very customizable (dynamic) headers, with logos and line breaks. Even page breaks are possible, so in the end, tcPdf can be used as (almost) fully fledged tool for letters or contracts generation (which way my main objective).

I will share my code in a more relevant topic on the forum later on.
Please post the code that you used for page breaks and images. I have played with tcpdf a bit and had a lot of trouble. Adding one element often breaks another. I was never able to get a header with an image to work correctly.
By nobody
Hi Amos,

as regards the line breaks, this always worked for me in PDFs (not in docs):
Code: Select all
<p style="page-break-before: always;"></p>
Place it anywhere you like in the HTML code.

As regards the images in header, I had to modify the outputDocument.php in opt/processmaker/workflow/engine/classes. I draw inspiration from one of your previous posts.
Find the following piece of code in the file (starting somewhere on the line 881):
Code: Select all
$pdf->SetAutoPageBreak(true, $margins['bottom']);
and replace it with the following:
Code: Select all
    $myHeaderMargin = $aFields['myHeaderMargin'];     //In the trigger, you can define an additional margin to be added to the top 
        $pdf->SetLeftMargin($margins['left']); //this I have not changed
        $pdf->SetTopMargin($margins['top']+$myHeaderMargin); //Note that here the top header margin is increased if you set so in the trigger. It is useful to set some margin (lets say 15) in the trigger if the header has to have two or more lines
        $pdf->SetAutoPageBreak(true, $margins['bottom']-15);//I subtracted 15 to add more space for footer, though so far I were not able to get the footers work

/*This snippet suppresses the additional lines that are added by the tcPDF when generating the output document.
It is necessary to create a variable (e.g. suppresslines) and define it in the trigger;
$suppressLines =  $aFields['suppressLines'];
if (isset ($suppressLines) && $suppressLines == "Yes") {
 $tagvs = array(
 'p' => array(0 => array('n' => 0, 'h' => ''), 1 => array('n' => 0, 'h' => ''))
 /*This is where the variables defined in the trigger for the logo come into play
$logoHeaderSource = $aFields['logoHeaderSource'];
$logoHeaderWidth = $aFields['logoHeaderWidth'];
$logoString = $aFields['logoString'];
$headerLineColor =  $aFields['headerLineColor'];              
           $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, 'B', PDF_FONT_SIZE_MAIN));
           $pdf->SetHeaderData( $logoHeaderSource, $logoHeaderWidth, '', $logoString,'',$headerLineColor);
Then, create the following trigger:
Code: Select all
//define headers for output document

@@logoHeaderSource = "yourImageFileName.png";
@@logoHeaderWidth = 140;
@@myHeaderMargin = 0;
@@logoString = "APPLICATION FORM" .$randomString;   
@@headerLineColor = array(255,255,255); //white, for black type "0,0,0"
//@@suppressLines = "Yes";
Note that the logo file needs to be stored in TCPDF/images directory (create the images directory if it does not exist).
This images directory is default directory for images in TCPDF. It is usually located in processmaker ->gulliver->thirdparty->tcpdf->images.

This way, you can even have dynamic headers, since you can customize anything you need (the logo, its width, the text of the logo) in the trigger.
I only hope this has been clear enough, it has been a while since I have been doing that.
Calculate hours of day/week

Thank you Amos, The four other variables are for[…]

timing control

I suggest that you file a bug report about it at[…]

Hello Amos, Would this solution work also for PM […]

Hi amosbatto! When I send a request from ajax to[…]