Phpword: How to add a signature line to a document?

Created on 21 Jun 2017  路  6Comments  路  Source: PHPOffice/PHPWord

I would like to use PHPWord to create forms that users can sign with their personal certificates using signature lines included in the generated document.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Change Request

All 6 comments

This is currently not supported by PHPWord.

I don't know if this would help, but this is a signature line extracted from a .docx document.xml:
```































http://phpoffice.github.io/PHPWord/docs/master/classes/PhpOffice.PhpWord.TemplateProcessor.html#method_replaceBlock

With $templateProcessor->replaceBlock() I was able to see something in LibreOffice (had to use as the start tag, removing the w:rsidR="00D44987" w:rsidRDefault="00D44987" parameters)
Not sure what MSWord does with it. I'll play with it tomorrow at the office.

@swordf1zh

If we make a

${signatureblock}
Here will be the signature after replaceBlock()
${/signatureblock}

And then replaceBlock("signatureblock", $bigxmlsignature); it works for me. Gives a cross in MSOffice, with a line surrounded by a rectangle. However, it uses an existing image inside the document in LibreOffice, but at least it opens in both.

I have not been able to figure out how to sign it though. So those tests are for you.

remember to put each ${block} on a separate line (to ensure the required, separate, <w:p> paragraph's)

Issue can be closed?

Was this page helpful?
0 / 5 - 0 ratings