Forum


Replies: 1   Views: 4138
How can i set position to watermark to footer?
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by gh_ost  · 23-10-2017 - 06:49

Hellow! 

I want add water makr to footer for even page.

My frist variant is


        $footerImage = new WordFragment($word,' defaultFooter');
        $footerImage->addImage([
            'src' => 'img/logo_blue_sidebar_en.png',
            'height' => 50,
            'width' => 150,
        ]);
        
        $word->addFooter(['even' => $footerImage]);
        $word->createDocx($documentName);

  But after replace some elements to HTML this image in footer disappeared. If i set image to footer after replacing variables to HTML elements i can't add image to footer. 

$htmlFontSize = '18.5px';
        $docx = new CreateDocxFromTemplate($documentName.'.docx');
        //ЗаменÑм Ð¿Ð¾Ð»Ñ Ð³Ð´Ðµ наш переменные на текÑÑ‚ где иÑпользовалоÑÑŒ CKEDITOR
        $docx->replaceVariableByHTML('MEMBERSHIP', 'block', '<div style="font-size: '.$htmlFontSize.'; ">'.$membership.'</div>', ['isFile' => false, 'parseDivsAsPs' => true, 'downloadImages' => false]);

        if($person->expertise_experience_has == 1)
            $docx->replaceVariableByHTML('EXPERIENCE', 'block', '<div style="font-size: '.$htmlFontSize.'; ">'.$expertiseExperience.'</div>', ['isFile' => false, 'parseDivsAsPs' => true, 'downloadImages' => false]);

        $docx->replaceVariableByHTML('PUBLICATIONS', 'block', '<div style="font-size: '.$htmlFontSize.'; ">'.$publications.'</div>', ['isFile' => false, 'parseDivsAsPs' => true, 'downloadImages' => false]);
        $docx->replaceVariableByHTML('PATENTS', 'block', '<div style="font-size: '.$htmlFontSize.'; ">'.$receivedPatents.'</div>', ['isFile' => false, 'parseDivsAsPs' => true, 'downloadImages' => false]);
        //Download
        $docx->createDocxAndDownload($documentName);
        unlink($documentName.'.docx');

 On second variant i use: 

//WaterMark
        $waterMarkParams = [
            'image' => 'img/logo_blue_sidebar_en.png',
            'height' => 50,
            'width' => 150,
            'decolorate' => false,
        ];

        $docx = new DocxUtilities();
        $source = $documentName.'.docx';
        $target = $documentName.'.docx';
        $docx->watermarkDocx($source, $target, $type = 'image', $options = $waterMarkParams);
        //end Watermark

I can't set position to lower left corner. How can i solve this problem? Thanks