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 - GetTextWidth for form field
  FAQ FAQ  Forum Search   Register Register  Login Login

GetTextWidth for form field

 Post Reply Post Reply
Author
Message
FLA View Drop Down
Beginner
Beginner
Avatar

Joined: 08 Oct 15
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote FLA Quote  Post ReplyReply Direct Link To This Post Topic: GetTextWidth for form field
    Posted: 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
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3530
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
FLA View Drop Down
Beginner
Beginner
Avatar

Joined: 08 Oct 15
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote FLA Quote  Post ReplyReply Direct Link To This Post 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
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