Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Insert image in PHPWord and Set as Background

I would like to insert an image to my docx with PHPWord and set it as background or send it to back. But the codes that have given in the documents seems not working and have some errors in it. I hope you guys help me in my problem. Thank you!

Here is my sample code regarding my problem with PHPWord.

$templateProcessor = new TemplateProcessor('Template.docx');

$templateProcessor->setImageValue('UserLogo', array('path' => 'images/background.jpg', 'width' => 100, 'height' => 100, 'ratio' => false));

    return array('path' => SlowFeatureImageGenerator::make(), 'width' => 100, 'height' => 100, 'ratio' => false);
});

I am new with PHPWord.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

I also had the same problem too but I think this will help us here. How to add/set images on PHPOffice/PHPWord Template?

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading