Add additional text on signature apply
Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan
Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.
When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.
When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Add additional text on signature apply
Is there a way to place extra text in the signature and initial stamp when placed?
e.g. I would like to do the following
Thanks
Simon
e.g. I would like to do the following
Thanks
Simon
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Add additional text on signature apply
Hello Simon,
Well it was faster to code then to explain + it's a useful sample so here you go:
This should be used in the pdfCtl_OnEvent in the e_operBeforeExecute:
Cheers,
Alex
Well it was faster to code then to explain + it's a useful sample so here you go:
Code: Select all
public void ModifyStampOnPlacement(IPXS_Inst pxsInst, ref IPXC_Annotation annot)
{
uint stampAnnotType = pxsInst.StrToAtom("Stamp");
if (annot.Type != stampAnnotType)
return;
object objApp = annot.Handler.GetAppearance(annot, null);
IPXS_PDFVariant varApp = (IPXS_PDFVariant)objApp;
if (varApp == null)
return;
IPXC_XForm xForm = annot.Page.Document.GetXForm(varApp);
if (xForm == null)
return;
IPXC_Content content = xForm.GetContent(PXC_ContentAccessMode.CAccessMode_WeakClone);
IPXC_ContentCreator cc = annot.Page.Document.CreateContentCreator();
cc.Attach(content);
cc.SetFontSize(14.0f);
PDFXEdit.IColor color = auxInst.CreateColor(PDFXEdit.ColorType.ColorType_RGB);
color.SetRGB(0.0f, 0.0f, 1.0f);
cc.SetFillColorRGB(color.RGB);
color.SetRGB(1.0f, 0.0f, 0.0f);
cc.SetStrokeColorRGB(color.RGB);
PDFXEdit.IPXC_Font fnt = pdfCtl.Doc.CoreDoc.CreateNewFont2("ArialMT");
cc.SetFont(fnt);
PXC_Rect rc = xForm.get_BBox();
cc.ShowTextLine(rc.left + 10, rc.bottom + 20, "TEST");
xForm.SetContent(cc.Detach());
}
Code: Select all
if (opAddAnnot == oper.ID)
{
PDFXEdit.IOperation oper = (PDFXEdit.IOperation)e.pFrom;
int opAddAnnot = pdfCtl.Inst.Str2ID("op.annots.addNew", false);
PDFXEdit.ICabNode input = oper.Params.Root["Input"];
PDFXEdit.IPXC_Annotation annot = input[0].v as PDFXEdit.IPXC_Annotation;
ModifyStampOnPlacement(pxsInst, ref annot);
input.v = annot;
}
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Re: Add additional text on signature apply
Hi Alex,
Thanks for the code, I am working in vb, but that is fine as I converted it all successfully, however I am getting an exception.
I have added your code PDF control onEvent and am using the following code (please note this is a snippet as my onEvent code is quite long):
The ModifyStampOnPlacement code all runs fine, however on the following line of code from the above code snippet it gives me and exception:
Exception is:
"Value does not fall within the expected range"
And PDFXchange error code is:
"Error [System]: The parameter is incorrect."
Thanks
Simon
Thanks for the code, I am working in vb, but that is fine as I converted it all successfully, however I am getting an exception.
I have added your code PDF control onEvent and am using the following code (please note this is a snippet as my onEvent code is quite long):
Code: Select all
ElseIf e.nEventID = nIDS(CInt(IDS.e_operExecuted)) Then
Try
Dim oper As PDFXEdit.IOperation = DirectCast(e.pFrom, PDFXEdit.IOperation)
Dim input As PDFXEdit.ICabNode = oper.Params.Root("Input")
Dim commands As String = Me.docPreview.Inst.ID2Str(oper.ID)
If oper.ID = Me.docPreview.Inst.Str2ID("op.annots.addNew", False) Then
disableProperties()
' If in sign mode then we assume that the user has just placed a signature as that is all they can do
If MISData.Instance.ViewerMode = "Sign" Then
MISData.Instance.frmMain.btnApplyAllSign.Enabled = True
MISData.Instance.frmMain.btnCancelSign.Enabled = True
Dim annot As PDFXEdit.IPXC_Annotation = TryCast(input(0).v, PDFXEdit.IPXC_Annotation)
ModifyStampOnPlacement(pxsInst, annot)
input.v = annot
End If
Code: Select all
input.v = annot
"Value does not fall within the expected range"
And PDFXchange error code is:
"Error [System]: The parameter is incorrect."
Thanks
Simon
Re: Add additional text on signature apply
Alex,
Please ignore previous post, I put is under the e_operExecuted NOT e_operBeforeExecute as you said.
Thanks
Simon
Please ignore previous post, I put is under the e_operExecuted NOT e_operBeforeExecute as you said.
Thanks
Simon
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Add additional text on signature apply
Hello Simon,
My mistake - should be input[0].v = annot; if it's needed anyway (try without it).
Cheers,
Alex
My mistake - should be input[0].v = annot; if it's needed anyway (try without it).
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Re: Add additional text on signature apply
Alex,
There is one small issue, it seems to only add the text under the signature if the signature is created from importing an image and not your "Draw Signature" option
Thanks
Simon
There is one small issue, it seems to only add the text under the signature if the signature is created from importing an image and not your "Draw Signature" option
Thanks
Simon
Re: Add additional text on signature apply
Also Alex I want to get some text on a second line as well, and I have tried the following, but it puts it on a single line?
Thanks
Simon
Thanks
Simon
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Add additional text on signature apply
Hello Simon,
There is a problem with hand-drawn stamps and we will try to fix that for the next release - we'll add some methods to the IPXC_Content interface that will allow to draw correctly for all the cases. As for the two lines of text - either use the ShowTextLine method two times with different coordinates, or use a ShowTextBlock method.
Cheers,
Alex
There is a problem with hand-drawn stamps and we will try to fix that for the next release - we'll add some methods to the IPXC_Content interface that will allow to draw correctly for all the cases. As for the two lines of text - either use the ShowTextLine method two times with different coordinates, or use a ShowTextBlock method.
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
-
- User
- Posts: 5522
- Joined: Fri Nov 21, 2014 8:27 am
- Contact:
Re: Add additional text on signature apply
Hello Simon,
You will have to add this line of code for this to work properly for all of the cases:
Cheers,
Alex
You will have to add this line of code for this to work properly for all of the cases:
Code: Select all
cc.Attach(content);
cc.ResetAllStatesToDefault();
cc.SetFontSize(14.0f);
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ