change the Background image in pdf File

Hi,

i want to change the Background image in the pdf Files.

Im not a programmer so i have found in the pdf.lip.php the following code:

// Add a background image on document if (! empty($conf->global->MAIN_USE_BACKGROUND_ON_PDF)) // Warning, this option make TCPDF generation beeing crazy and some content disappeared behin the image { $pdf->SetAutoPageBreak(0,0); // Disable auto pagebreak before adding image $pdf->Image($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_USE_BACKGROUND_ON_PDF, (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_X)?$conf->global->MAIN_USE_BACKGROUND_ON_PDF_X:0), (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y)?$conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y:0), 0, $page_height); $pdf->SetAutoPageBreak(1,0); // Restore pagebreak } }

I want to insert an image url like http://mydomain.com/background.jpg

How can i do that?

Hope someone can help me here.

Thanks and regards

Hi Michael001,

You’ll find the answer at http://wiki.dolibarr.org/index.php/Setup_Other :

[…]Some options are not visible in the interface (often because they are deprecated or beta features). In most cases you do not need these functions and their use may make the application unstable.
To enable them you have to define a constant to 1 in Home -> Setup -> Other setup:

[…]

MAIN_USE_BACKGROUND_ON_PDF => Define this constant with short name of an image (example “myimage.jpg”) that must be saved into directory “documents/mycompany/logos”. This will add this background image into your generated PDF files. Warning: This option make TCPDF library beeing crazy sometime and content on image disappeared !

MAIN_USE_BACKGROUND_ON_PDF_X and MAIN_USE_BACKGROUND_ON_PDF_Y are necessary for the position.

1 Like

Hi Mr. Schumacher :happy: ,

thanks for your answer. It works fine!!!
I have used the pdf Background, not the image Background so i made 2 different files. 1 with and 1 without the Background. It works perfect.

regards

Michael