Results 1 to 1 of 1
- 12-21-2010, 01:23 AM #1Member
- Join Date
- Dec 2010
- Rep Power
Setting text width and height in PDFBox
I have a list of tuples like this:
where (x1,y1) is the lowest left corner and (x2,y2) is the upper right corner of a box which should display the text in testLine, all values x1,y1,x2,y2 are pixel values. I also have two values pageWidth and pageHeight which represents the width and height of a page in pixels. Note I assume that (0,0) is in the lower left corner of the paper in this explanation of my problem.
Now I want to place these text lines on the page where each text line should have width x2-x1 and height y2-y1, and display the text textLine, notice that the rendered text will be stretched due to the restrictions on the widht and height, but that is part of what I want.
Now my end result should be a single paged PDF with all the text lines where each contain textLine and is placed at the positions given in (x1,y1) and (x2,y2).
Now the problem is that PDFBox seems to place text according to the scheme that it has a placement point (x,y) and a scale (sx,sy) of the text. This can of course do what I want above IF I already know the width and height of the final rendered text, but the only problem is I do not know how to get these values :S Any ideas how to get these values or solve my problem in a different way?.
Thanks in advance :)
- By pradeep_das in forum Advanced JavaReplies: 1Last Post: 05-06-2010, 10:48 AM
- By LovJava in forum AWT / SwingReplies: 5Last Post: 04-24-2010, 01:16 AM
- By email@example.com in forum AWT / SwingReplies: 3Last Post: 11-16-2009, 08:26 AM
- By hitmen in forum AWT / SwingReplies: 3Last Post: 03-06-2009, 01:12 PM
- By neeraj.singh in forum AWT / SwingReplies: 10Last Post: 02-18-2009, 02:09 PM