#1 2023-11-14 15:04:52

relder
Member
Registered: 2023-11-14
Posts: 1

Chinese characters won't display

Hi everyone,
in my application I print some multi-lingual pdf documents: all works perfectly fine except for the chinese characters, they won't display at all.
I'm using the standard TCanvas methods on the TPdfDocumentGDI.VCLCanvas property, which is passed as argument to a method of an object (the template).

LPdf := TPdfDocumentGDI.Create;
try
  Result := AOutputPath + OutputName + '.pdf';
  LPdf.ScreenLogPixels := 72;
  LPdf.UseUniscribe := True;
  LPage := LPdf.AddPage;
  LTemplate.PaintCanvas(LPdf.VCLCanvas);
  LPdf.SaveToFile(Result);
finally
  LPdf.Free;
end;

Inside the method PaintCanvas I do the following:
  ACanvas.Pen.Color := clBlack;
  ACanvas.Font.Size := 8;
  ACanvas.Brush.Style := bsClear;
  ACanvas.Font.Name := 'Microsoft YaHei';
  ACanvas.TextRect(ARect, ARect.Left, ARect.Top, AValue);

ARect: TRect and AValue: string are passed as arguments and are filled accordingly (I checked under debugger).

For every other charset/font it's working fine (even japanese and korean), but the chinese ones simply won't display (even if they ARE on the pdf document - and they are since I can copy them from the document).
The font is correctly installed and I don't know what is going wrong: I tried outputting the values on other delphi canvas and it works just fine. So I'm guessing that the problem lies on the printing process of the pdf document, but I couldn't figure out where.

Thank you in advance for your help.

Offline

Board footer

Powered by FluxBB