Skip to content

fcl-pdf: For standard PDF fonts, umlauts are not working.

The standard (built in) PDF fonts (Times, Helvetica, Courier..) are not Unicode aware.

The existing code in fppdf.pp is using UTF8ToAnsi for these, which does not work here.

It works, if I use LConvEncoding.UTF8ToCP1252 for these, ideally right in the constructor, like:

constructor TPDFString.Create(Const ADocument : TPDFDocument; const AValue: string);
begin
  inherited Create(ADocument);
  FValue := UTF8ToCP1252(AValue);
  if (Pos('(', FValue) > 0) or (Pos(')', FValue) > 0) or (Pos('\', FValue) > 0) then
    FValue := InsertEscape(FValue);
end;

and remove the conversion in TPDFString.Write.

I know that LConvEncoding is not part of the FCL. What is a better way to fix this?

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information