Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Watermark via Template Processor #2274

Open
matthewknill opened this issue Aug 2, 2022 · 1 comment
Open

Add Watermark via Template Processor #2274

matthewknill opened this issue Aug 2, 2022 · 1 comment

Comments

@matthewknill
Copy link

We are quite extensively using the template processor for our ordering system. The issue though is that we want to be able have a watermark set or not without having to duplicate all our templates.

After all the template processing has been done, I currently have the following code in an attempt to get this working:

// ...
$templateProcessor->saveAs($orderPath.'/'.$tmpFile.'.docx');

// Add watermark
$tmpFile = uniqid('TMP_');
$PHPWord = IOFactory::load($orderPath.'/'.$tmpFile.'.docx');
$section = $PHPWord->addSection();
$header = $section->addHeader();
$header->addWatermark('/path/to/draft.png', ['marginTop'=>200, 'marginLeft'=>55]);
$PHPWord->save($orderPath.'/'.$tmpFile.'.docx');

The problem with this though is that it messes up the entire document and also seems to not even be showing the watermark. Furthermore, it would be nice to set DRAFT like you can in Word without having to supply an image...

@github-actions
Copy link

github-actions bot commented Nov 1, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If this is still an issue for you, please try to help by debugging it further and sharing your results.
Thank you for your contributions.

@github-actions github-actions bot added the Stale label Nov 1, 2022
@Progi1984 Progi1984 removed the Stale label Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants