PHPWord/samples/Sample_18_Watermark.php

20 lines
578 B
PHP
Raw Normal View History

<?php
2014-03-15 22:39:57 +07:00
include_once 'Sample_Header.php';
// New Word document
2015-01-01 20:41:42 +04:00
echo date('H:i:s'), ' Create new PhpWord object', EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();
// Begin code
$section = $phpWord->addSection();
$header = $section->addHeader();
$header->addWatermark('resources/_earth.jpg', array('marginTop' => 200, 'marginLeft' => 55));
2015-01-01 20:41:42 +04:00
$section->addText(htmlspecialchars('The header reference to the current section includes a watermark image.'));
// Save file
2014-04-12 10:12:24 +07:00
echo write($phpWord, basename(__FILE__, '.php'), $writers);
if (!CLI) {
include_once 'Sample_Footer.php';
}