#1 PDF Engine » mORMot2 export PDF file output Chinese string prompt error problem. » 2024-09-27 05:03:12

jianwt
Replies: 1

Please consult everyone, in windows10 platform lazarUS3.0, export PDF file with mORMot2 output Chinese string prompt error.

procedure TForm1.Button1Click(Sender: TObject);
var
  Pdf: TPdfDocumentGDI;
begin
  Pdf := TPdfDocumentGDI.Create;
  try
// Pdf.EmbeddedTTF:=True;
    Pdf.AddPage;
    with Pdf.VCLCanvas do
    begin
      Pen.Color := clRed;
      Pen.Width := 2;
      Brush.Color := clInfoBk;
      Rectangle(100, 100, 400, 200);
      Font.Name := '宋体';
      Font.Size := 20;
 
      TextOut(200, 120, '测试内容'); {An error is reported as long as the input is a Chinese string. How to solve it? }
      //TextOut(200, 120, 'AAAA123');  {This output is normal}
      Pen.Color := clYellow;
      Pen.Width := 5;
      MoveTo(100, 250);
      LineTo(400, 250);
    end;
    Pdf.SaveToFile(ExtractFilePath(Application.ExeName) +'ceshi.pdf');
  finally
    Pdf.Free;
  end;
end;     

The error message is:
项目project1提引异常类'External: ACCESS
VIOLATION'带有信息:
Access violation reading from address $00000000.
在文件'mormot,ui.pdf,pas'在行6167:
result :=
fUsedWide[FindOrAddUsedWidechar(aWidechar...

Board footer

Powered by FluxBB