Error on displaying signature using LoadFromFile
Error is 'Invalid characters in path [xxxxxxxx.otf]'
This is using Delphi 12 migrating from FMX signature component.
Error on displaying signature using LoadFromFile
Error is 'Invalid characters in path [xxxxxxxx.otf]'
This is using Delphi 12 migrating from FMX signature component.
The signature file from FMX will not be compatible with FNC
Thanks Pieter. This a clean install so not using FMX file. Trying to load the file saved with the FNC component using SaveToFile
File generated attached-usually saving as .sig but had to change for upload
265182-approvalSignature.c (1.4 KB)
Can you send me the application that you used to generate the signature? Did you generate it on the same platform with the same version of the component?
On Andriod I get the error above. On Windows - where the file i sent was generated it just fails to load.
I'm not able to send you the entire application but I can post the relevant pieces of code here
To save
fname := string.format('%d-approvalSignature', [selectedAppointment.UID]);
{$IF Defined(ANDROID) or Defined(IOS)}
localPathFilename := TPath.Combine(TPath.GetDocumentsPath, 'docs' + PathDelim + fname + '.png');
localSigFilePathFilename := TPath.Combine(TPath.GetDocumentsPath, 'docs' + PathDelim + fname + '.sig');
{$ELSE}
localPathFilename := TPath.Combine(ExtractFileDir(ParamStr(0)), 'docs' + PathDelim + fname + '.png');
localSigFilePathFilename := TPath.Combine(ExtractFileDir(ParamStr(0)), 'docs' + PathDelim + fname + '.sig');
{$ENDIF}
sigSignOff.SaveToImageFile(localPathFilename);
AddTextToImage(localPathFilename);
sigSignOff.SaveToFile(localSigFilePathFilename);
To load
sigSignOff.Empty := true;//Clear();
fname := string.format('%d-approvalSignature.sig', [selectedAppointment.UID]);
{$IF Defined(ANDROID) or Defined(IOS)}
sigSignOff.ClearSig.Image.LoadFromFile(TPath.Combine(TPath.GetDocumentsPath, 'sigclear.png'));
if (TFile.Exists(TPath.Combine(TPath.GetDocumentsPath, 'docs' + PathDelim + fname))) then
sigSignOff.LoadFromFile(TPath.Combine(TPath.GetDocumentsPath, 'docs' + PathDelim + fname));
{$ELSE}
sigSignOff.ClearSig.Image.LoadFromFile(TPath.Combine(ExtractFileDir(ParamStr(0)), 'sigclear.png'));
if (TFile.Exists(TPath.Combine(ExtractFileDir(ParamStr(0)), 'docs' + PathDelim + fname))) then
sigSignOff.LoadFromFile(TPath.Combine(ExtractFileDir(ParamStr(0)), 'docs' + PathDelim + fname));
{$ENDIF}
if (selectedAppointment.ApptSigText.HasValue) and (not string.IsNullOrEmpty(selectedAppointment.ApptSigText)) then
sigSignOff.Text := selectedAppointment.ApptSigText
else
sigSignOff.Text := 'I am happy with the work undertaken.';
How frustrating. This is the object definition
object sigSignOff: TTMSFNCSignatureCapture
Align = Top
Position.Y = 303.000000000000000000
Size.Width = 1083.000000000000000000
Size.Height = 194.000000000000000000
Size.PlatformDefault = False
TabOrder = 3
Font.Name = 'Segoe UI'
Pen.Color = claBlack
Text = 'I am happy with the work undertaken.'
TextPosition.Line.Color = claGray
ClearSig.Image.PNG = {
89504E470D0A1A0A0000000D4948445200000018000000180806000000E0773D
F80000000473424954080808087C08648800000197494441544889D595B159C3
3010857F4243E9115C523A1B281BC00424138027E03141B281DD510626401B60
3A3AC20464040A9DBF28427602547995ACBB7BEFEE249DE1D471D62F2495C012
288067A095B4FDAFC0245A2F812BC0D9FA4392FE2B1057B03681141D303BB61A
4945CF23A98D2BA8811C4945A8A63A40EC2435C017700BF8BD0ACCA904D6469A
C342529BC4CC811B426B015692EADEBE27100509B81F1391E48006286D7F6336
1F3B67054CA432825C355DB2BF021E72E73428100989E16A3664B28E31193224
02B301B31F2307383F42E00A78042E32E6CA39F7E9BDEF86E2472B90B424DCAA
C2B6B6C053E2D68C5DE1AC80A442D22B70176D6F090FEE1A5824216B7B608705
2C9B0FF66F494FDE994F9B8894841BF7037B6760E42FEC5AF283BC87F7BE73CE
95512297CEB937EFFD7BEC974ED3D7841CE05A52DAF738A90698DBE70698C6EF
216E519321AFC7C84D6001B4F65992BC993373AA2CFB18AD051F85A49269DFD2
BE82744CFF8ADC5013460884FF09B140CB6E54AFFE408EF57D6622CE86E1E159
F407A182700EA5BD9913C7370546A41FF73136EB0000000049454E44AE426082}
end
No its not an old file. It's created with that code. The signature field is on a TTabControl. Perhaps moving to the TabItem is causing the issue. The load code above is called and then the move to the tab requested. Although trying the move before the code seems to make no difference.
I get the failed to load behaviour whilst viewing the same tab with two very simple buttons.
procedure TfmMain.Button1Click(Sender: TObject);
var localSigFilePathFilename: string;
begin
localSigFilePathFilename := TPath.Combine(ExtractFileDir(ParamStr(0)), 'docs' + PathDelim + 'approvalSignature.sig');
if (TFile.Exists(localSigFilePathFilename)) then
sigSignOff.LoadFromFile(localSigFilePathFilename);
end;
procedure TfmMain.Button2Click(Sender: TObject);
var localSigFilePathFilename:string;
begin
localSigFilePathFilename := TPath.Combine(ExtractFileDir(ParamStr(0)), 'docs' + PathDelim + 'approvalSignature.sig');
sigSignOff.SaveToFile(localSigFilePathFilename);
end;
Is it possible that FNC is just not installed correctly?
Hi Pieter,
Can you please confirm if the demo provided does not work for you on Delphi 12 on Windows 64 please
The above project is an FMX project.
In a new VCL project with the code
procedure TForm1.Button1Click(Sender: TObject);
var localSigFilePathFilename: string;
begin
localSigFilePathFilename := TPath.Combine(ExtractFileDir(ParamStr(0)), 'approvalSignature.sig');
if (TFile.Exists(localSigFilePathFilename)) then
sigSignOff.LoadFromFile(localSigFilePathFilename);
end;
procedure TForm1.Button2Click(Sender: TObject);
var localSigFilePathFilename:string;
begin
localSigFilePathFilename := TPath.Combine(ExtractFileDir(ParamStr(0)), 'approvalSignature.sig');
sigSignOff.SaveToFile(localSigFilePathFilename);
end;
I get an access violation when trying to load the signature
We have fixed an issue here. It was related to some size differences of types in Delphi 12. To fix the issue, change
AStream.Write(FSignaturePoints.Count, SizeOf(FSignaturePoints.Count));
to
AStream.Write(FSignaturePoints.Count, SizeOf(Integer(FSignaturePoints.Count)));
at line 680
Thank you, that has resolved this issue for us