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

How to add a signature line to a document? #1078

Open
tribal2 opened this issue Jun 21, 2017 · 6 comments
Open

How to add a signature line to a document? #1078

tribal2 opened this issue Jun 21, 2017 · 6 comments

Comments

@tribal2
Copy link

tribal2 commented Jun 21, 2017

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.

@troosan
Copy link
Contributor

troosan commented Jun 26, 2017

This is currently not supported by PHPWord.

@tribal2
Copy link
Author

tribal2 commented Jun 27, 2017

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

<w:p w:rsidR="00D44987" w:rsidRDefault="00D44987">
	<w:r>
		<w:pict>
			<v:shapetype id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f">
				<v:stroke joinstyle="miter"/>
				<v:formulas>
					<v:f eqn="if lineDrawn pixelLineWidth 0"/>
					<v:f eqn="sum @0 1 0"/>
					<v:f eqn="sum 0 0 @1"/>
					<v:f eqn="prod @2 1 2"/>
					<v:f eqn="prod @3 21600 pixelWidth"/>
					<v:f eqn="prod @3 21600 pixelHeight"/>
					<v:f eqn="sum @0 0 1"/>
					<v:f eqn="prod @6 1 2"/>
					<v:f eqn="prod @7 21600 pixelWidth"/>
					<v:f eqn="sum @8 21600 0"/>
					<v:f eqn="prod @7 21600 pixelHeight"/>
					<v:f eqn="sum @10 21600 0"/>
				</v:formulas>
				<v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/>
				<o:lock v:ext="edit" aspectratio="t"/>
			</v:shapetype>
			<v:shape id="_x0000_i1025" type="#_x0000_t75" alt="Línea de firma de Microsoft Office..." style="width:192.1pt;height:95.9pt">
				<v:imagedata r:id="rId5" o:title=""/>
				<o:lock v:ext="edit" ungrouping="t" rotation="t" cropping="t" verticies="t" text="t" grouping="t"/>
				<o:signatureline v:ext="edit" id="{0FD480A8-96BA-439A-87D0-8510E2DA2824}" provid="{00000000-0000-0000-0000-000000000000}" o:suggestedsigner="Jhon Doe" o:suggestedsigner2="Director" o:suggestedsigneremail="[email protected]" o:signinginstructions="Sign here" signinginstructionsset="t" issignatureline="t"/>
			</v:shape>
		</w:pict>
	</w:r>
	<w:bookmarkStart w:id="0" w:name="_GoBack"/>
	<w:bookmarkEnd w:id="0"/>
</w:p>

@FBnil
Copy link

FBnil commented Sep 26, 2017

Also this information helps: https://stackoverflow.com/questions/9812161/trying-to-insert-a-digital-signature-line-in-a-docx-file

@FBnil
Copy link

FBnil commented Sep 26, 2017

http:https://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 <w:p> 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.

@FBnil
Copy link

FBnil commented Oct 6, 2017

@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)

@FBnil
Copy link

FBnil commented Oct 28, 2017

Issue can be closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants