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!
![]() |
GetTextWidth for form field |
Post Reply
|
| Author | |
FLA
Beginner
Joined: 08 Oct 15 Status: Offline Points: 3 |
Post Options
Thanks(0)
Quote Reply
Topic: GetTextWidth for form fieldPosted: 08 Oct 15 at 5:48PM |
|
Hi,
I'm new to QuickPdf and have a problem with the following task : - I've got three fields "as a group" in a customer PDF and the text i need to put in them is large, so i must fit in the three fields (field1, field2 and field3). The text is an enumeration like : item1, item2, item3, item4, item5, item6, item7, ... I need to parse this text to the 3 fields depending on the fields width ex : Field1 : item1, item2, item3, Field2 : item4, item5, item6, Field3 : item7 I made something to do the job with iteration such as GetTextWidth("item1, item2, item3, item4, item5, item6, item7") --> too long for field1 GetTextWidth("item1, item2, item3, item4, item5, item6") --> too long for field1 GetTextWidth("item1, item2, item3, item4, item5") --> too long for field1 GetTextWidth("item1, item2, item3, item4") --> too long for field1 GetTextWidth("item1, item2, item3") < Field1.width --> so OK for field1 and so on..for field2 and field3 It's ok even if there is often enough space to put an extra item on each field (1) In my case GetFormFieldTextSize(field1) = 10 and FontSize() return 0. Is there a way to set the FontSize() ? How the GetTextWidth(string) works because FontSize() return 0 ? (1) : Is there another function to do this test more accuratly ? Have you got an idea or a tip to enhance my job ? If i've got a bigger string to fit, I'd like to iterate and reduce the font size by decrement to finally fit the three fields...but how to test the string width with smaller font ? Thanks in advance
|
|
![]() |
|
Ingo
Moderator Group
Joined: 29 Oct 05 Status: Offline Points: 3530 |
Post Options
Thanks(0)
Quote Reply
Posted: 17 Oct 15 at 7:12PM |
|
Hi FLA,
Perhaps that "FontSize" returns 0 depends on the used font?: http://www.debenu.com/docs/pdf_library_reference/FontSize.php Yes. You can set the textsize: http://www.debenu.com/docs/pdf_library_reference/SetTextSize.php GetTextWidth won't work in your case 'cause it's based on "FontSize": http://www.debenu.com/docs/pdf_library_reference/GetTextWidth.php Cheers and welcome here, Ingo |
|
|
Cheers,
Ingo |
|
![]() |
|
FLA
Beginner
Joined: 08 Oct 15 Status: Offline Points: 3 |
Post Options
Thanks(0)
Quote Reply
Posted: 19 Oct 15 at 9:07AM |
|
Hi,
I've found a solution here : http://www.debenu.com/kb/converting-pixels-and-inches-to-postscript-points/ I needed to convert pixels to points to do my job. Thanks |
|
![]() |
|
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