Print Page | Close Window

Fonts have not the same size.

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=2734
Printed Date: 31 May 25 at 8:44AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Fonts have not the same size.
Posted By: lyborko
Subject: Fonts have not the same size.
Date Posted: 17 Sep 13 at 11:33PM

I am working on an application, in which the text rendered on the TCanvas (Delphi) should be rendered in the PDF document using QuickPDF functions. To my big surprise, I do not see the same result, when I compare Tcanvas output and PDF output. I become wast differences. 

here is small snippet, how I set PDF font via normal TFont


procedure SetFontOnQuickPDF(AFont:TFont; AQuickPDF:TQUickPDF);
var r,g,b:Double;
begin
if (not (fsBold in AFont.Style)) and (not (fsItalic in AFont.Style)) then AQuickPDF.AddTrueTypeFont(AFont.Name, 0);
if (fsBold in AFont.Style) and (not (fsItalic in AFont.Style)) then AQuickPDF.AddTrueTypeFont(AFont.Name + ' [Bold]', 0);
if (not (fsBold in AFont.Style)) and (fsItalic in AFont.Style) then AQuickPDF.AddTrueTypeFont(AFont.Name + ' [Italic]', 0);
if (fsBold in AFont.Style) and (fsItalic in AFont.Style) then AQuickPDF.AddTrueTypeFont(AFont.Name + ' [BoldItalic]', 0);
if fsUnderline in AFont.Style then AQuickPDF.SetTextUnderline(1) else AQuickPDF.SetTextUnderline(0);

  AQuickPDF.SetTextSize(AFont.Size);

end;


Has anybody encountered this kind of a problem?


thanx


Lyborko




Replies:
Posted By: AndrewC
Date Posted: 18 Sep 13 at 12:13AM
Lyborko,

Which version of QPL are you using ?
How are you converting your Drawing commands from TCanvas to QuickPDF ? ie.  How is DrawText called ?

You may want to have a quick read of the following

http://support.microsoft.com/kb/74299" rel="nofollow - http://support.microsoft.com/kb/74299

QPL and PDF use measure the fontsize as the character size. 
GDI+, TCanvas measure the fontsize based on cell hight.  

The difference is the internal leading value.  In Delphi if you specify -(fontsize) when you draw onto the TCanvase then you should get similar results to the QuickPDF library fontsize.


Posted By: lyborko
Date Posted: 18 Sep 13 at 12:48AM

Thank you for your reply

I am using Debenu PDF library 9.12


please look at this code

procedure TForm1.btn9Click(Sender: TObject);
var QuickPDF:TQuickPDF;
iPrintOptions:integer;
s:string;
begin
s:='I am working on an application, in which the text rendered on the TCanvas (Delphi) should be rendered in the PDF document using';
img1.Picture.Bitmap.Width:=img1.Width;    // here it is 595 pixels, which is width of A4 in "points"
img1.Picture.Bitmap.Height:=img1.Height;
img1.Picture.Bitmap.Canvas.Font.Name:='Arial';
img1.Picture.Bitmap.Canvas.TextOut(0,0, s);
QuickPDF:=TQuickPDF.Create;
if QuickPDF.UnlockKey('<insert key here>') = 1 then //DebenuPDFLibrary0912
begin
QuickPDF.SetOrigin(1);
QuickPDF.SetPageSize('A4');
QuickPDF.CompressImages(1);
iPrintOptions := QuickPDF.PrintOptions(0, 0, Application.ExeName);

QuickPDF.AddTrueTypeFont(img1.Picture.Bitmap.Canvas.Font.Name, 0);
QuickPDF.SetTextSize(img1.Picture.Bitmap.Canvas.Font.Size);

QuickPDF.DrawText(0,30, s);
QuickPDF.PrintDocument(QuickPDF.GetDefaultPrinterName(), 1, 1, iPrintOptions);
QuickPDF.SaveToFile(GetCurrentDir + '\Color.pdf');
end;
QuickPDF.Free;

end;


The result is strikingly different from TCanvas template. PDF has smaller font. I would like to include pictures, but ... 

may you help?






Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk