Creating PDF from TMS WEBCore application

Delphi 10.3 / TMSWebCore 1.5.6.0 / TMSFNC UI Pack 3.2.2.0

Tried the example from the TMS FNC PDF Library doc:

procedure TForm1.GeneratePDF(AFileName: string);
var
 p: TTMSFNCPDFLib;
 s: string;
begin
 p := TTMSFNCPDFLib.Create;
 try
 s := 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has
been the industry''s standard dummy'+
 'text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to
make a type specimen book. '+
 'It has survived not only five centuries, but also the leap into electronic typesetting,
remaining essentially unchanged. It'+
 ' was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum
passages, and more recently with des'+
 'ktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.';
 p.BeginDocument(AFileName);
 p.NewPage;
 p.Graphics.Font.Name := 'Arial';
 p.Graphics.Font.Size := 8;
 p.Graphics.Fill.Color := gcNull;
 p.Graphics.DrawText(s, RectF(10, 50, 500, 400), 3);
 p.EndDocument(True);
 finally
 p.Free;
 end;
end;

In a normal VCL application the content of the created PDF is as expected:

When I execute the same code inside a TMS WebCore application the output is looking like this:

Any idea where this comes from?

Please make sure the font used for PDF generation is loaded by the web app. The PDF engine needs to access font files for information to be embedded in the PDF.
Please look at the guidance at

Where can I download the complete project for "Ate too much candy" ?

In the PDF documenation, on the last page there is a description about Web Support - Font caching. Where to find the

AddFontToCache()

method?

It is all explained in the docs.
For this particular question:


page 19

Please refer to our documentation, it can all be found at
https://www.tmssoftware.com/site/manuals.asp

I know that font caching is described on page 19 of the documentation, that is my code:

procedure TForm1.WebFormCreate(Sender: TObject);
begin
  Application.OnFontCacheReady:= OnFontCacheReady;
end;



procedure TForm1.OnFontCacheReady(Sender: TObject);
begin
  AddFontToCache ('arial.ttf');
  AddFontToCache('tahoma.ttf');
end;

The example app "Ate too much candy" doesn't say anything about the font caching, at least not in the sample code wich shows only the pdf generation. Do I miss something? Can I download the complete example project somewhere?

The sample is in FNC UI Pack
Demo\Web\PDFLib BMI

You need to enable Pako compression also in your web app, also that is explained in the PDF guide.

Ok, thank you - that was a misunderstanding when you sent me the link for "Ate too much candy" Its part of the TMS FNC UI examples. Got it and found the information I was missing.

procedure TForm1.WebFormCreate(Sender: TObject);
begin
  AddFontToCache('arial.ttf');
  AddFontToCache('tahoma.ttf');
end;

where the two font files are locally part of the project, made it finally work.

Thank you for your patience