TFlexCelPdfExport Error trying to embed font 'Calibri' in the document

if i call PDF.Export(Filename) then on one of my Computers i get this error:

    Error trying to embed font 'Calibri' in the document.
Font licensing doesnt allow embedding.

I am using following code:

if ExelSave then
begin
  Xls.Save(dateiName);
  Pdf := TFlexCelPdfExport.Create(Xls, True);
  try
    pdf.FallbackFonts := 'Arial Unicode MS'; // did not help
    PDF.FontEmbed := FlexCel.Pdf.TFontEmbed.Embed; // did not help
    Pdf.PdfType := TPdfType.Standard;
    Var Dn:String;
    Dn:=dateiName.Replace('.xls', '.pdf');

    Pdf.export(Dn); //<<<< error on this Line

  finally
    Pdf.Free;
  end;
end;

I read the document "FlexCel PDF Exporting Guide" it say that i have to findout if the Font Calibri is installed.
Yes the font Calibri with 6 fontTypes are installed in Windows\Fonts.

Any ideas what i can do?

Hi,
It looks like you have a different version of calibri that doesn't allow embedding inside documents. I wonder if you go to \Windows\Font, double click in Calibri, then go to properties, is the font listed as "Editable"? This is how I see it here (and there are no problems embedding it)

In any case, this is a check FlexCel does to ensure you aren't embedding a font that you are not licensed to embed. If you know your version of Calibri is legally licensed to embed, you can ignore this message by useing TFlexCelPdfExport.UnlicensedFontAction Property | FlexCel Studio for VCL and FireMonkey documentation

like:
pdf.UnlicensedFontAction := TUnlicensedFontAction.Ignore;

You can also set up a "replacement font" that will be used for fonts whose license doesn't allow embedding them into other documents. But the strange thing in all of this is that calibri license, as far as I know, allows embedding. So I am interested to know if you have an special version of it.

This works.

My Font is Editable like you show it.
My Fileversion is 6.23

Can you email me the font to adrian@tmssoftware.com? I'd like to find out what is wrong with it, as it shows as "Editable". Calibri is just the font used in 99% of documents and we never seen it flagged as not embeddable. So I'd like to investigate it a little more, maybe there is some bug in our code to detect the licensing requirements.

This is the Font i am using.

defektCalibri.zip (3.7 MB)

Thanks for the files. It is weird, I can't see the error here, and I can't understand how it can happen given that the font has a "editable" attribute in its licensing (as it should be for calibri). I've re-reviewed the code, but it looks correct (and it is working correctly in this machine). I am a little out of ideas, but I'll try to think about it a little more.

I am experiencing this same issue with FlexCel generating PDF from an Excel template. It began early March and is occurring even with installed versions of the program that I have on my computer. However the program installed on another computer is able to generate a PDF from Excel template with Calibri font.

I did install FlexiPDF and then Adobe Acrobat 2020 the week before noticing the issue. Also believe there was a Office 365 update. Not sure if any of that is connected, but maybe there is something common that might be cause.

Can you search for calibri*.ttf in your hard disk, and check the properties of all the files to see if they have "editable" permissions?

If possible, I'd also like if you can create a new Console Application, and paste the code below, then run the app and tell me the results:

program Project2;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  System.SysUtils,
  FlexCel.VCLSupport,
  _PdfTrueType.TPdfTrueType,
  _PdfTrueType.TFontDataReader,
  _PdfTrueType.TChunkByteArray,
  _UIClasses.TUIFont,
  _PdfFontFactory.PdfFontFactory,
  _UIClasses.TUIFontStyle,
  _PdfConsts.TPdfFontFolderNotFoundAction;

procedure DumpFont(const Name: string; const fs: TUIFontStyleSet);
var
  pdf: TPdfTrueType;
  FontData: TChunkByteArray;
begin
  FontData := PdfFontFactory.GetFontData(TUIFont.CreateNew(Name, 12, fs), 'c:\windows\fonts', TPdfFontFolderNotFoundAction.DefaultBehavior);
  pdf := TPdfTrueType.Create(TFontDataReader.Create(FontData), 'test', true);
  WriteLn('Name: ', pdf.PostcriptName);
  WriteLn('EmbedForbidden: ', pdf.EmbedForbidden);

  WriteLn;

end;

begin
  DumpFont('Calibri', []);
  DumpFont('Calibri', [TUIFontStyle.fsBold]);
  DumpFont('Calibri', [TUIFontStyle.fsItalic]);
  DumpFont('Calibri', [TUIFontStyle.fsBold, TUIFontStyle.fsItalic]);

  DumpFont('Calibri Light', []);
  DumpFont('Calibri Light', [TUIFontStyle.fsBold]);
  DumpFont('Calibri Light', [TUIFontStyle.fsItalic]);
  DumpFont('Calibri Light', [TUIFontStyle.fsBold, TUIFontStyle.fsItalic]);
  readln;
end.

I edited the code in my previous post to try all font variations, in case the problem is not with calibri, but with a variant.