EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Introduce "\n" into the SignerInfo PDF

Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.
#20494
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:
Code
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
#20496
Posted: 06/18/2012 13:00:12
by Eugene Mayevski (EldoS Corp.)

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


Sincerely yours
Eugene Mayevski
#20501
Posted: 06/18/2012 16:07:37
by Dmytro Bogatskyy (EldoS Corp.)

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
http://www.eldos.com/documentation/sb...rance.html
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).
#23196
Posted: 01/15/2013 13:59:04
by Emilio Cano (Standard support level)
Joined: 12/27/2012
Posts: 5

Hello!
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:
Code
        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!


#23199
Posted: 01/15/2013 18:20:12
by Dmytro Bogatskyy (EldoS Corp.)

Quote

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:
Code
TextData := TElPDFSignatureWidgetText.Create;
TextData.CustomData := Format(N2STREAM_CONTENTS_CUSTOM_TEXT, [FormatTextMatrix(3, 13, 35, 11), '11AA22BB33445566' );
Sig.WidgetProps.CustomText.Add(TextData);

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

    N2STREAM_CONTENTS_CUSTOM_TEXT =
      '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 +
      'Q'#13#10;


Update: added support for FontSizeX and FontSizeY parameters to Add method, so the code above is equivalent to:
Code
Sig.WidgetProps.CustomText.Add('11AA22BB33445566', 35, 11, 3, 13);
#23210
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: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.

Reply

Statistics

Topic viewed 2064 times

none




|

Back to top

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

Got it!