user1349751
user1349751

Reputation: 81

Trying to export a report with unicode text to pdf using SynPDF, results in mixed-up text

SynPDF have fixed some unicode issues, but not all of them aparently. The following is a streight forward code for exporting a quickreport to PDF usiny SynPDF:

procedure TForm1.CreatePdf(QuickRep: TCustomQuickRep; const aFileName: TFileName);
var
Pdf: TPdfDocument;
aMeta: TMetaFile;
i: integer;
begin
  Pdf := TPdfDocument.Create;
  Pdf.UseUniscribe := True;
  try
      Pdf.DefaultPaperSize := psA4;
      QuickRep.Prepare; 
      for i := 1 to QuickRep.QRPrinter.PageCount do begin
        Pdf.AddPage;
        aMeta := QuickRep.QRPrinter.GetPage(i);
        try
          // draw the page content
          Pdf.Canvas.RenderMetaFile(aMeta,1,0,0);
        finally
          aMeta.Free;
        end;
      end;
      Pdf.SaveToFile(aFileName);
  finally
    Pdf.free;
  end;
end;

Here is a screenshot of a report designer with a label, that has hebrew string that translates:

Phone: 03-5555555 Phone

This is shown at runtime as is, and also prints the same. With SynPDF however, the result is the following: PhonePDF

Does anyone know what can be done about this?

The reason I'm using SynPDF is because it's free,

and because it renders the text from the metafile

rather than just take a picture,

which means I get high quality text with my pdf file.

but I wont rule out other components, given they

have a solution to this problem.

Thank you.

Upvotes: 1

Views: 2674

Answers (0)

Related Questions