Watermark.php 531 B

123456789101112131415161718192021
  1. <?php
  2. require_once '../PHPWord.php';
  3. // New Word Document
  4. $PHPWord = new PHPWord();
  5. // New portrait section
  6. $section = $PHPWord->createSection();
  7. // Create header
  8. $header = $section->createHeader();
  9. // Add a watermark to the header
  10. $header->addWatermark('_earth.jpg', array('marginTop'=>200, 'marginLeft'=>55));
  11. $section->addText('The header reference to the current section includes a watermark image.');
  12. // Save File
  13. $objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
  14. $objWriter->save('Watermark.docx');
  15. ?>