Print Page | Close Window

SetFormFieldValue and text width

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: General Discussion
Forum Description: Discussion board for Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=353
Printed Date: 19 May 24 at 4:47PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: SetFormFieldValue and text width
Posted By: jabaltie
Subject: SetFormFieldValue and text width
Date Posted: 09 Mar 06 at 7:22AM
I'm using QuickPDF to stuff data into empty form fields of template PDFs. So, for instance, I have on my VBScript :

obj.SetFormFieldValueByTitle("NAME","JOSE ADRIANO BALTIERI")

The problem is :

Sometimes the field content is larger than the designed form field. So, data is truncated when the PDF is printed. If I load the PDF, I can "see" the data by scrolling within the field. But I need it to be printed OK, because my main goal is to print the PDF.

Finally , my question is :

Is it possible to detect when data may be truncated, that is, to detect this size error ?

Something like :

obj.SetFormFieldValueByTitle("NAME","JOSE ADRIANO ALTIERI")
if DATATRUNCATED
    do something to warn
endif

Thanks in advance for your support !



Replies:
Posted By: bogey
Date Posted: 09 Mar 06 at 7:36AM

I don't know that you could determine exactly how many characters can fit a form field based on the size and the getFormFieldTextSize, but you can override the font to "auto" which will scale long text down till it fits in the blank.

Set the font using SetFormFieldTextSize(index,0).

Of course you may also run into potential problems with the design department or law department if you adjust font sizes without their knowledge.



Posted By: jabaltie
Date Posted: 09 Mar 06 at 8:09AM
I'm afraid I should not change any text properties.

My principle here is that my client, that is, my final user, designs the template. He/she chooses the lay out by drawing the form using Open Office and then exporting it to PDF.

So, the principle is to respect this design.

What I want is to detect problems while I'm stuffing data into this design or template.

So, the approach is to tell the final user that the field that he/she designed for "NAME" is not large enough.

He/She should fix the template.

Got it ?


Posted By: bogey
Date Posted: 09 Mar 06 at 8:18AM

I fully agree the issue need to go back to the form designer. Either show them how to set the fontsize to "auto", or tell them that overflows cannot be controlled. I don't think there is an "overflow" function to detect the problem.

You could make an estimate if it is a fixed-pitch font. For example, if you know it is a courier 10 font in the field, you could calulate the characted that could be displayed by dividing the size by the character pitch. But this would only be an approximation for most fonts.



Posted By: jabaltie
Date Posted: 09 Mar 06 at 8:42AM
Not always the Auto is a good aproach cause it is very common that the user designs a box around the field, that is, a framing box.

In any case however, this box will step over the adjoining fields.

So, I really need QuickPDF to monitor when a form field is stepping over someone else's toes !


Posted By: bogey
Date Posted: 09 Mar 06 at 10:20AM

The "auto" text size will reduce the text to fit the existing field. Not expanding the box.



Posted By: PDFman
Date Posted: 10 Mar 06 at 7:55AM

Why not read back the value after writing it. Then compare the strings and give a message to the user if they do not compare.

 

Best regards,

/Stefan



Posted By: bogey
Date Posted: 10 Mar 06 at 8:39AM

Because the data is going into the field, only getting truncated visually. Reading it back would bring back the full value.

 




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