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:
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
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?
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.