EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Introduce "\n" into the SignerInfo PDF

Also by EldoS: Callback File System
Create virtual file systems and disks, expose and manage remote data as if they were files on the local disk.
Posted: 06/18/2012 12:43:21
by Greg Werner (Standard support level)
Joined: 04/25/2008
Posts: 13

Hi i used the example TinySigner, i noticed that if i use:
Sig.WidgetProps.AlgorithmCaption = "Llave publica: ";
Sig.WidgetProps.AlgorithmInfo = "Prueba Algorthm Info";
Sig.WidgetProps.Header = "Prueba Header";
Sig.WidgetProps.SignerCaption = "Firmante: ";
Sig.WidgetProps.SignerInfo = "Prueba Signer Info";

I can add text to my pdf sign, the question is how i can introduce "\n" in order to produce a new line to the SignerInfo
Posted: 06/18/2012 13:00:12
by Eugene Mayevski (Team)

Did you try just
Sig.WidgetProps.SignerInfo = "Prueba\nSigner Info";

Sincerely yours
Eugene Mayevski
Posted: 06/18/2012 16:07:37
by Dmytro Bogatskyy (Team)

Standard widget properties (Header, SignerInfo and etc.) wouldn't work as multiline. They have a predefined relative position in the signature widget.

You can do following things:
1. You can use TElPDFSignatureWidgetProps.CustomAppearance property
but you would need to use PDF graphics operators. And construct a whole signature widget.
2. You can use TElPDFSignatureWidgetProps.CustomText property to place a custom text to a specific position. This property could work together with standard widget properties or by alone (also use TElPDFSignatureWidgetProps.HideDefaultText property to hide default text).
Posted: 01/15/2013 13:59:04
by Emilio Cano (Standard support level)
Joined: 12/27/2012
Posts: 5

I'm trying to put their own text and place it in a position.
This perfect, the problem I have used the font as the text is very bad.
This is the code I use:
        Sig.WidgetProps.AutoSize := false;
        Sig.WidgetProps.AutoText := false;
        Sig.WidgetProps.Width := 327;
        Sig.WidgetProps.Height := 70;
        Sig.WidgetProps.ShowTimestamp := false;
        Sig.WidgetProps.SignerInfo := '';
        Sig.WidgetProps.SignerCaption := '';
        Sig.WidgetProps.AlgorithmInfo := '';
        Sig.WidgetProps.AlgorithmCaption := '';
        Sig.WidgetProps.BackgroundStyle := pbsCustom;
        Sig.WidgetProps.Background.ImageType := pitJPEG2000;
        Sig.WidgetProps.Background.Data := ImageToArray(ExtractFilePath(Application.ExeName)+'Firma.jp2');
        Sig.WidgetProps.AutoStretchBackground := true;
        Sig.WidgetProps.Background.Width := 700;
        Sig.WidgetProps.Background.Height := 150;
        Sig.WidgetProps.AutoPos := false;
        Sig.WidgetProps.OffsetX := 265;
        Sig.WidgetProps.OffsetY := 10;
        Sig.WidgetProps.Print := true;
        Sig.WidgetProps.HideDefaultText := true;
        Sig.WidgetProps.CustomText. Add('11AA22BB33445566', 35, 11, 3);

The result I get is the attachement file.

What I want is that the code '11AA22BB33445566' look better.

Thank you!

Posted: 01/15/2013 18:20:12
by Dmytro Bogatskyy (Team)


Sig.WidgetProps.Width := 327;
Sig.WidgetProps.Height := 70;
Sig.WidgetProps.CustomText. Add('11AA22BB33445566', 35, 11, 3);

The text become stretched because widget is not rectangular.
The current solution would be to use CustomData property of the TElPDFSignatureWidgetText class to insert custom graphical operators, for example:
TextData := TElPDFSignatureWidgetText.Create;
TextData.CustomData := Format(N2STREAM_CONTENTS_CUSTOM_TEXT, [FormatTextMatrix(3, 13, 35, 11), '11AA22BB33445566' );

  function FormatTextMatrix(FontSizeX, FontSizeY: Double; X: Double; Y: Double): string;
    AFormatSettings : TFormatSettings;
    AFormatSettings := TFormatSettings.Create;
    AFormatSettings.DecimalSeparator := '.';
    Result := Format('%f 0 0 %f %f %f', [[FontSizeX, FontSizeY, X, Y]], AFormatSettings);

      'q'#13#10 +
      'BT'#13#10 +
      '/T1_0 1 Tf'#13#10 +
      '0 Tc 0 Tw 0 Ts 100 Tz 0 Tr %s Tm'#13#10 +
      '(%s)Tj'#13#10 +
      'ET'#13#10 +

Update: added support for FontSizeX and FontSizeY parameters to Add method, so the code above is equivalent to:
Sig.WidgetProps.CustomText.Add('11AA22BB33445566', 35, 11, 3, 13);
Posted: 01/16/2013 02:38:04
by Emilio Cano (Standard support level)
Joined: 12/27/2012
Posts: 5

Thank you!! It's a perfect solution!
Also by EldoS: BizCrypto
Components for BizTalk® and SQL Server® Integration Services that let you securely store and transfer information in your business automation solutions.



Topic viewed 2283 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!