Reputation: 11
I'm trying to use tbs/opentbs with PHP to switch out an image in my docx file. I'm using
The docx file does download. When I open it using MS Word 2021 I get the following message:
Word found unreadable content in "filename.docx". Do you want to recover the contents of this document? If you trust the document, click Yes.
Upon clicking "Yes" the file opens in MS Word and the image has indeed been changed out correctly as expected. This popup every time a file is opened is obviously not ideal, so I'm trying to figure out how to correct the outputted docx file so it does not need to be repaired every time.
If I remove the changepic/OPENTBS_CHANGE_PICTURE, then the debugging message goes away and the file opens without a warning, but obviously my picture is no longer replaced.
I've tried both methods in found in the docs
$TBS->PlugIn(OPENTBS_CHANGE_PICTURE, 'Picture 1', $Image)
;$TBS->VarRef['x'] = $signatureImageDocxTmp;
In both cases I get the following output at the bottom of my page when debugging:
<br /><b>TinyButStrong Error</b> with PlugIn() method: '1' is an invalid plug-in key, the type of the value is 'boolean'.<br />
<br /><b>TinyButStrong Error</b> Show() Method: The output is cancelled by the OpenTBS plugin because at least one error has occured.<br />
I am expecting no errors and for the resulting docx file to open in MS Word without the warning popup and need for repair.
Looking in tbs_class.php I see the following function 'PlugIn' which is throwing the error, and it does not seem to expect a boolean value at all for the $Prm1 parameter.
Upvotes: 1
Views: 146