Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Fonts have not the same size.
  FAQ FAQ  Forum Search   Register Register  Login Login

Fonts have not the same size.

 Post Reply Post Reply
Author
Message
lyborko View Drop Down
Beginner
Beginner


Joined: 31 Jul 12
Location: Li
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote lyborko Quote  Post ReplyReply Direct Link To This Post Topic: Fonts have not the same size.
    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

Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post 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


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.
Back to Top
lyborko View Drop Down
Beginner
Beginner


Joined: 31 Jul 12
Location: Li
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote lyborko Quote  Post ReplyReply Direct Link To This Post 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?





Edited by AndrewC - 18 Sep 13 at 5:16AM
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store