On Wed, 7 Jul 2004 16:42:06 -0500, Keith L. Musser wrote:
> I'm currently finding iText 1.02b useful for generating PDF. Nice job on an easy to
> use API. :)
>
> There is one capability that I need which, as best I can tell, is not supported:
> I'd like to be able to easily output something formatted roughly as follows:
[snip]
I have accomplished this for my purposes using the ColumnText class rather
than a paragraph class. See the following function. (This is vb.net, and
strictly speaking it uses the J# port iText.net, not the original iText;
and even worse, I've wrapped some of the details into one of my own classes
called iTextPDF. But perhaps you can gain some insight anyway.)
Sub DoTextBox(ByVal oPDF As iTextPDF, _
ByVal strOverflowFile As String, _
ByVal strText As String)
' Create a ColumnText object,
' assigned to the ContentOver stream of our pdf
Dim ct As New ColumnText(oPDF.cbOver)
' Create a font to use
Dim bf As BaseFont = BaseFont.createFont(BaseFont.TIMES_ROMAN, _
BaseFont.CP1252, BaseFont.NOT_EMBEDDED)
' Add text to the ColumnText.
ct.addText(New Phrase(strText, New Font(bf, 12, 0)))
' set the first-line indent to zero, and following lines to 9 pts.
ct.Indent = (0)
ct.FollowingIndent = (9)
' setSimpleColumn sets up what we need. This is a single column
' with the bounding box taken from the wrapper object,
' a height of three inches, 16 pt leading, and left aligned text
ct.setSimpleColumn(oPDF.left, oPDF.bottom, oPDF.right, 3 * 72, _
16, Element.ALIGN_LEFT)
' the rest of this fills the text to the box we wanted, overflowing
' to additional pages if necessary.
' "continued on" and "continued from" lines to the overflows.
Dim status As Integer
status = ct.go()
Do Until status = ct.NO_MORE_TEXT
oPDF.newPage()
ct.setSimpleColumn(oPDF.left, oPDF.bottom, oPDF.right, _
oPDF.top - 16, 16, Element.ALIGN_LEFT)
status = ct.go()
Loop
End Sub
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions