Print Page | Close Window

DrawText, DrawBox

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=3876
Printed Date: 20 Apr 24 at 11:08AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: DrawText, DrawBox
Posted By: PatVdv
Subject: DrawText, DrawBox
Date Posted: 13 Jan 21 at 8:59AM
Hi All,

I'm just trying to design a box under a text, for the value of the width it is correct, but I don't understand what's wrong with the height ?

Patrick

ie :

 with aPdf do
 begin      
       sTxt:='PROFORMA';
       SetTextSize(30);
       iWidth  := GetTextWidth(sTxt);
       iHeight:= GetTextAscent - GetTextDescent;

        iY:=10;
        iX:=130;
        SetFillColor(0.88,0.88,0.88);
        DrawBox(iX,iY,iWidth,iHeight,1);
        SetTextColor(1,0.13,0.13);
        DrawText(iX,(iY+iHeight),sTxt);
 end;




Replies:
Posted By: Ingo
Date Posted: 13 Jan 21 at 7:37PM
Hi Patrick,

in the description for both functions (ascent/descent) you can read "...Returns the size of the selected font...". But i don't see that you've already selected a font.
Try SelectFont first before you try to do the settings for a font ;-)
https://www.debenu.com/docs/pdf_library_reference/SelectFont.php
Here you'll find a lot for the first start:
http://www.quickpdf.org/

Cheers and welcome here,
Ingo




-------------
Cheers,
Ingo



Posted By: PatVdv
Date Posted: 14 Jan 21 at 2:52PM
Thanks Ingo,

You are right, I didn't show it here, but the font was selected before. I'll go deep into the documentation anyway.

Patrick




Posted By: Ingo
Date Posted: 14 Jan 21 at 10:27PM
LastErrorCode after each function call let you see if the last call works or fails...


-------------
Cheers,
Ingo




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