#1 Re: PDF Engine » Question about font styles » 2012-10-31 08:57:51

ab wrote:

Yes, I suspect that underlined and striken font style have to be implemented by hand, since they are not existing in the PDF definition, AFAIR.

Another possibility is to use the TCanvas version of the library, and here you will have all usual font drawing at hand.

Thanks for the clarification!
I'm now using TGDIPages instead of TPdfDocument, and it works perfectly with every style!

#2 PDF Engine » Question about font styles » 2012-10-30 08:38:25

noctrex
Replies: 2

Hello!
I'm trying to use your excellent SynPdf library, but it seems that I must be going something wrong.
I want to use different font styles on a text, that is going to exported to pdf, and I'm trying this:

procedure TForm1.Button1Click(Sender: TObject);
var
  pdf: TPdfDocument;
begin
  pdf := TPdfDocument.Create;
  pdf.AddPage;

  pdf.Canvas.BeginText;
  pdf.Canvas.SetFont('Courier New', 20, []);
  pdf.Canvas.TextOut(200, 500, 'Normal String');

  pdf.Canvas.SetFont('Courier New', 20, [fsBold]);
  pdf.Canvas.TextOut(200, 450, 'Bold String');

  pdf.Canvas.SetFont('Courier New', 20, [fsItalic]);
  pdf.Canvas.TextOut(200, 400, 'Italic String');

  pdf.Canvas.SetFont('Courier New', 20, [fsUnderline]);
  pdf.Canvas.TextOut(200, 350, 'Underlined String');

  pdf.Canvas.SetFont('Courier New', 20, [fsStrikeOut]);
  pdf.Canvas.TextOut(200, 300, 'StrikeOut String');
  pdf.Canvas.EndText;

  pdf.SaveToFile('test.pdf');
  pdf.Free;
end;

It seems that the underline and the strikeout styles are not working, I'm getting only normal text.
Is there something extra that I must do?
Thank you.

Board footer

Powered by FluxBB