Print Page | Close Window

Drawing Text on PDF forms

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=186
Printed Date: 25 Nov 24 at 2:36AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Drawing Text on PDF forms
Posted By: loufeliz
Subject: Drawing Text on PDF forms
Date Posted: 27 Nov 05 at 1:17PM
I am succesfully using QuickPDF to take Forms, determine form field positions and then after manually removing form fields build documents using multiple pages of same form page. My problem now is that each page has a collumn of numbers and I need them to print Right Aligned, but instead they are printing left aligned.

I need some help or quidance on workig with fonts and how to get draw text that is Right Aligned.

Once solved QuickPDF will replace a solution that is slow and requires MS Word to generate a Word Document instead of a PDF.

- Lou



Replies:
Posted By: Ingo
Date Posted: 28 Nov 05 at 1:26AM
Hi Lou,

i think you've read all about SetFormFieldAlignment in the documentation? Are you sure to work on the formfields you want? What are the returned values of SetFormFieldAlignment? ...0 or 1?
What happens if you're working with GetFormFieldalue? Comes your values back with right alignement?

I've made the experiences that working with formfields isn't easy. Good luck!

Best regards,
Ingo


-------------
Cheers,
Ingo



Posted By: loufeliz
Date Posted: 28 Nov 05 at 9:55AM

Hi Ingo,

Actually I am not using formfields. I am just drawing the text at a set of coordinates. Proiblem is that I need numbers to right align and when I put a collumn of values the allign on left instead of right as below:

65.23

21,100.45

Not sure how to ge the to right align.  When you have lots of values it is not very nice to look at.  Anyway I am guessing I need to do some font work or calculate the width and adjust coordinates, just looking for some guidance.

 

- Lou



Posted By: Ingo
Date Posted: 28 Nov 05 at 10:10AM
Hi Lou!
If you write numeric fields in the output the alignment should work. When you're working with numeric values on a pdf document you're working only with the content (and a 1.5 is shorter than 123.25).
You can work with form fields. If you don't want you must detect the string length of each single value to write it in the document a few pixels to the right or a few pixels to the left.
...I think you should take formfields.


-------------
Cheers,
Ingo



Posted By: chicks
Date Posted: 28 Nov 05 at 11:36AM
If you know the width of your column, use SetTextAlign() with DrawTextBox().

Have a look at Invoice.pdf here:

http://www.planetpdf.com/forumarchive/94629.asp

It was laid out with a visual tool, then saved as PDF. The variable data was then printed on the static PDF using iSEDQuickPDF, including the right-aligned columns. See iSedPE.zip to see how it was done (iTextPE.zip is a java version - you can also use the .NET version of iText to do the same in .NET)


Posted By: Ingo
Date Posted: 28 Nov 05 at 5:23PM
Hi Chicks,

do you think that's easier than using formfields?


-------------
Cheers,
Ingo



Posted By: chicks
Date Posted: 28 Nov 05 at 5:28PM
Not easier, but OP states that he's not using form fields.

It is, however, much more flexible than form fields - note that you can print images and barcodes (without a barcode font), which you can't do with form fields.

Also note that flattening doesn't always work well with QuickPDF, but this method always works. The original template DOES have form fields, but they're just used for positioning, font info, etc. before being removed. The final PDF is also smaller than with flattened form fields.



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