Print Page | Close Window

FitTextBox doesnt work

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=852
Printed Date: 14 May 24 at 3:49AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: FitTextBox doesnt work
Posted By: jabaltie
Subject: FitTextBox doesnt work
Date Posted: 04 Jan 08 at 11:41AM
I have some PDF templates that look like contracts. They're PDFs with empty form fields.

I'm removing the form fields and replacing them by using DrawTextBox instead (because FlattenFormField function is messy).

On some paragraphs , there's a field supplied for the client name and for this kind of field, FitTextBox would be better than using DrawTextBox.

Except that it doesnt work Cry

Guess there's some detail that I dont know.

I have made a script to reproduce the problem :

-----------

OPTION EXPLICIT

DIM objQPDF,lni,lnt
DIM X,Y,W,H,A,S

Set objQPDF = WScript.CreateObject("ISED.QUICKPDF")

objQPDF.unlockkey("yourkey")

objQPDF.NewDocument()
objQPDF.DocumentCount()

objQPDF.LoadFromFile("TEST035.PDF")

' GET TEST035.PDF from http://www.DES.online.unimep.br/au/pub/TEST035.pdf

lni=1

X=objQPDF.GetFormFieldBound(lni,0)
Y=objQPDF.GetFormFieldBound(lni,1)
W=objQPDF.GetFormFieldBound(lni,2)
H=objQPDF.GetFormFieldBound(lni,3)
A=objQPDF.GetFormFieldAlignment(lni)
S=objQPDF.GetFormFieldTextSize(lni)

lnt=objQPDF.FORMFIELDCOUNT()
for lni=lnt to 1 step -1
  objQPDF.DeleteFormField(lni)
next

objQPDF.SetTextAlign(A)
objQPDF.SetTextSize(S)

CALL objQPDF.FITTEXTBOX(X,Y,W,H,"JOSE ADRIANO BALTIERI",2)

objQPDF.SaveToFile("TEST035.PDF")

WScript.Echo "OK !"

--------------------

I'd expect to have "JOSE ADRIANO BALTIERI" scattered but it appears at the right, pretty much like as if I had used the DrawTextBox function.

What it would be wrong ?




Replies:
Posted By: chicks
Date Posted: 04 Jan 08 at 12:03PM
I think you had better read the document more closely. It doesn't say it will spread out text to fit available space, it says it will shrink the font size so that long text will fit in the available space.

There are functions available to calculate the length of the text to be printed, then you can calculate the difference and use SetTextCharSpacing to spread out the text, if you wish.



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