Signature captions

Posted by: jerrad.elmore on 24 March 2022, 5:36 am EST

    • Post Options:
    • Link

    Posted 24 March 2022, 5:36 am EST - Updated 29 September 2022, 11:09 pm EST

    A couple questions about signature captions. First, how can I change the caption on an unsigned SignatureField? I have tried setting several properties, but none of them have any effect (it always shows “Click to sign”).



    Second, when a field is signed, is there any way to force the signature image to take up more room, or to force the caption text to wrap?

    As you can see, the signature image is quite small compared to the caption. I know I could manually insert line breaks in the caption, but it would be nice if it would automatically wrap.

  • Posted 24 March 2022, 9:48 pm EST

    Hello,

    We are discussing this issue with the developers and will let you know as soon as we get the update from the developers’ end.

    [Internal Tracking ID: DOC-4137]

    Regards,

    Prabhat Sharma.

  • Posted 10 May 2022, 5:38 am EST - Updated 29 September 2022, 11:09 pm EST

    Wondering if there was any movement on this issue. I see now with version 5.1.0.791, if I set

    signatureField1.Widget.DefaultAppearance.Text = "Whatever";
    

    then the “Click to Sign” caption disappears, but it does not display “Whatever”. The background color of the field also changes for some reason.

  • Posted 10 May 2022, 5:54 am EST - Updated 29 September 2022, 11:09 pm EST

    Also, unrelated nitpick: I set the back color to YellowGreen, but the color of the field doesn’t look quite right. It isn’t as bright as it should be.

    UPDATE: Nevermind about the color. It is correct when the field is actually signed. It just appears to be a darker shade until it is signed.

  • Posted 10 May 2022, 5:00 pm EST

    Hello Jerrad,

    Thank you for the additional comments. I have forwarded this to the developers and also asked them about the update on this issue. We will update you soon on this.

    Regards,

    Prabhat Sharma.

  • Posted 12 May 2022, 9:27 pm EST - Updated 29 September 2022, 11:09 pm EST

    Hello,

    As per the developers,

    1. If you want to change the appearance of unsigned SignatureField you should create a custom appearance

      stream, you can use code like this: (also please see the attached project)
       GcPdfDocument doc = new GcPdfDocument();
                var p = doc.NewPage();
    
                // create an unsigned SignatureField with custom appearance
                SignatureField sf = new SignatureField();
                doc.AcroForm.Fields.Add(sf);
                sf.Widget.Page = p;
                sf.Widget.Rect = new RectangleF(20, 40, 200, 60);
                // create an appearance stream
                FormXObject fxo = sf.Widget.CreateAppearanceContentStream();
                GcGraphics g = fxo.Graphics;
                // draw appearance on fxoGraphics
                var r = fxo.Bounds;
                g.FillRectangle(r, Color.Yellow);
                TextFormat tf = new TextFormat()
                {
                    FontName = "Tahoma",
                    FontSize = 14,
                };
                g.DrawString("Some long text long text long text long text long text long text", tf, r, TextAlignment.Center, ParagraphAlignment.Center, true);
                // assign created appearance stream
                sf.Widget.AppearanceStreams.Normal.Default = fxo;
                doc.Save("unsigned.pdf");
    
    1. You can use CR LF to wrap long captions, for example (again you can see the attached project):
                sp.SignatureBuilder = new Pkcs7SignatureBuilder(cert);
                sp.SignatureAppearance.Caption = "Some\r\nLong\r\nCaption";
                sp.SignatureAppearance.Image = Image.FromFile(@"..\..\..\exif.jpg");
                sp.SignatureAppearance.CaptionImageRelation = GrapeCity.Documents.Pdf.Annotations.CaptionImageRelation.CaptionAtRight;
    
    1. DefaultAppearance is not related to the caption, please see XML comments:
         /// <summary>
            /// Gets the <see cref="Annotations.DefaultAppearance"/> object that specifies
            /// the visual properties (font, font size etc.) used to format the content of this annotation.
            /// </summary>
    
    1. Regarding to color, I have no idea what application you use to test, I tried to use MSPaint to test, and result (color) is the same, see the attached SS.

    Regards,

    Prabhat Sharma.



    ConsoleApp1.zip

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels