Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

TMSFNCSignatureCapture problem

 Post Reply Post Reply
Author
Bill Zwirs View Drop Down
New Member
New Member
Avatar

Joined: 13 Jan 2011
Posts: 19
Post Options Post Options   Quote Bill Zwirs Quote  Post ReplyReply Direct Link To This Post Topic: TMSFNCSignatureCapture problem
    Posted: 09 Nov 2019 at 8:46am
Delphi Rio 10.3.2
Latest FNC UI component pack
FMX App for Windows/iOS

Having trouble with the signature capture component when using savetostream.  All I get is a black background image - no signature.  In my code I also test with savetofile with same result. 

Any hints as to why this would be happening.

Bill Zwirs
Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 8329
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 09 Nov 2019 at 9:14am
SaveToFile/SaveToStream persist in the native internal vector format of the TTMSFNCSignatureCapture component.
If you need it as image file, use SaveToImageFile / SaveToImageStream
Back to Top
Bill Zwirs View Drop Down
New Member
New Member
Avatar

Joined: 13 Jan 2011
Posts: 19
Post Options Post Options   Quote Bill Zwirs Quote  Post ReplyReply Direct Link To This Post Posted: 09 Nov 2019 at 11:46pm
Have just tried using SaveToImageFile / SaveToImageStream but still get same result - black rectangle.  Is there something else I could be missing here.

Bill Zwirs
Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 8329
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 10 Nov 2019 at 9:34am
What image file format do  you save to? Did you choose PNG?
Back to Top
Bill Zwirs View Drop Down
New Member
New Member
Avatar

Joined: 13 Jan 2011
Posts: 19
Post Options Post Options   Quote Bill Zwirs Quote  Post ReplyReply Direct Link To This Post Posted: 10 Nov 2019 at 9:32pm
No. Image format is bmp. Just for a bit of background....I am populating fields in a pdf (invoice) and then adding a customer signature.  Using Gnostice Document Viewer component to achieve this and all works fine except for adding the signature. I have created an example signature .bmp file for testing  using Microsoft Paint and that works good so the problem is not the document viewer component. Gnostice tell me that I must use either bmp or jpg on their component - there is currently no support for png. The code I use is:

procedure TMainForm.Send_SignatureToInv;
var
  LFormField : TgtPDFFormField;
  ms,
  TempStream : TMemoryStream;
  LImage     : TgtBitmapSurface;
  bmp        : tBitmap;
begin
  LImage := TgtBitmapSurface.Create;
  TempStream := TMemoryStream.Create;
  ms := TMemoryStream.Create;
  bmp := TBitmap.Create;
  try
    InvSign.SaveToImageStream(ms);
    InvSign.SaveToImageFile('sig1.bmp');       //test ***********
    bmp.LoadFromStream(ms);
    bmp.SaveToFile('sig2.bmp');       //test ***************
    bmp.SaveToStream(TempStream);
    LImage := TgtBitmapSurface.Create;
    LImage.LoadFromStream(TempStream);
    LFormField := TgtPDFPage(InvViewer.ActiveDocument.GetPage(1)).Forms.ByName('SigButton');
    if Assigned(LFormField) and (LFormField.GetElementType = ietFormPushButton) then
      TgtPDFFormPushButton(LFormField).SetImage(LImage);
  finally
    InvSign.Empty := True;
    TempStream.Free;
    ms.Free;
    LImage.Free;
    bmp.Free;
  end;
end;

The test lines are there so I can see what the image looks like and each time it is a black rectangle (this matches what I see on the PDF).  'InvSign' is the name given to the signature capture component.  Never really worked with graphics before so it might simply be that my code is wrong.  Any help will be appreciated.

Bill Zwirs
Back to Top
Pieter Scheldeman View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 3392
Post Options Post Options   Quote Pieter Scheldeman Quote  Post ReplyReply Direct Link To This Post Posted: 11 Nov 2019 at 1:50pm
Can you try saving it to PNG/JPG and see what happens? It could potentially be an issue with the BMP format in FMX.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down