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!
FitTextBox |
Post Reply |
Author | |
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
Posted: 18 Jun 16 at 9:07AM |
a sample code from "rweetch".
How to reduce fontsize to fit into the area of a fix textbox: procedure TsmDebenuPDFLibraryHelper.DrawDownScaledText(const aText: string; const X, Y aWidth, aHeight: Double); var lTextSize, lStartSize: Double; begin lStartSize := GetTextSize; lTextSize := lStartSize; if GetWrappedTextHeight(aWidth, aText) > aHeight then begin lTextSize := lStartSize; repeat lTextSize := lTextSize * 0.95; SetTextSize(lTextSize); until (GetWrappedTextHeight(aWidth, aText) <= aHeight); end; DrawWrappedText(X, Y, aWidth, aText); if lTextSize < lStartSize then SetTextSize(lStartSize); end;
|
|
Cheers,
Ingo |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store