Hello,
i am trying to send one PDF from the XData Server as Encode64 string to the Web Application, but the PDF is empty after download it from the Webbrowser.
The VCL Server part works fine, but the Web part has a Problem.
I already tried to use a different PDF to send, but i get the same result as before.
The Fonts are already loaded
AddFontToCache('fonts\arial.ttf');
Here is a Screenshot from the PDF File which i want to send
Result from the Webapplication
Delphi 10.2.3
TMS Web Version 1.9.2.0
TMS FNC UI Version 3.7.2.0
//VCL Server
function TBookingService.PrintVoucher(BookingNr: string; BookingEmail :string) : string;
var
ls_Result :string;
ls_PDFResult :string;
lo_PDFStream :TStringStream;
begin
lo_PDFStream := TStringStream.Create;
ls_Result := SybDM.PrintVoucher(BookingNr);
if (ls_Result <> '') then
begin
ls_Result := TTMSFNCUtils.Encode64(ls_Result, false );
//OK
ls_PDFResult := TTMSFNCUtils.Decode64(ls_Result, false );
lo_PDFStream.WriteString(ls_PDFResult);
lo_PDFStream.SaveToFile('C:\temp\BookingNr_SRV.pdf');
end;
Result := ls_Result;
end;
//Web
function PrintVoucher() :string;
var ls_ResponseResult : string;
ls_PDFData : string;
lo_PDFData : TBytes;
ls_FileName :string;
begin
lo_Response:= Await(XDataWebClient1.RawInvokeAsync('IBookingService.PrintVoucher',[BookingNr,BookingEmail]));
ls_ResponseResult := string( TJSObject(lo_Response.Result)['value'] );
if (ls_ResponseResult <> '') then
begin
ls_PDFData := TTMSFNCUtils.Decode64(ls_ResponseResult, false );
Logging('Info','Decode Length: ' + inttostr(Length(ls_PDFData)));
Logging('Info','Decode Data: ' + ls_PDFData);
lo_PDFData := BytesOf(ls_PDFData);
Logging('Info','BytesOf Length: ' + IntToStr(Length(lo_PDFData)));
ls_FileName := 'Voucher_[BookingNr].pdf';
Application.DownloadPDFFile(lo_PDFData,ls_FileName,false);
end;
end;
What am i missing?
Thanks