1

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.

Community
  • 1
  • 1
user1349751
  • 81
  • 1
  • 6
  • Are you using latest version from https://github.com/synopse/SynPDF ? What is the `Canvas.RightToLeftText` property value as defined in `TPdfEnum.TextOut` method (line 9682)? – Arnaud Bouchez Sep 18 '14 at 11:53
  • I'm using the latest version I believe, which is 1.18 or 1.7 (its not clear to me). I downloaded it from the source website a few days ago, although that line shows me something completely different. When I added this line to my code: Pdf.Canvas.RightToLeftText := True;, it did nothing. – user1349751 Sep 18 '14 at 12:12
  • OK, just updated again. Line 9682 shows the correct code. – user1349751 Sep 18 '14 at 12:20
  • Canvas.RightToLeftText := (R.emrtext.fOptions and ETO_RTLREADING)<>0; Do I need to change it? I still get text in the wrong order – user1349751 Sep 18 '14 at 12:22
  • Try to force Canvas.RightToLeftText := true or false – Arnaud Bouchez Sep 19 '14 at 15:40
  • Thanks but, when I tried that just now: Setting it to False makes it worse, setting it to true doesn't help. – user1349751 Sep 19 '14 at 17:04

0 Answers0