How To wrap Text while using PdfContentByte in itextsharp

itext

Solution

use Column like this :

Dim p As Phrase = New Phrase("your txt", FontFactory.GetFont(BaseFont.HELVETICA, BaseFont.CP1250, True, fsize)) 
Dim ct As New ColumnText(cb) 
ct.SetSimpleColumn(p, x, y, ux, uy, 10, Element.ALIGN_LEFT)
ct.Go()

and fix width hight bloc ux, uy

see this also :

How to position and wrap long text?

Problem

I used PdfContentByte to show text in pdf in that i also used SetTextMatrix mathod for postion of that text now when my text is large it will not show in pdf show can i wrap the text show i can able to see it below is my code ``` PdfContentByte cb = myPDFWriter.DirectContent; cb.BeginText(); BaseFont bf_qty123 = BaseFont.CreateFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, false); cb.SetFontAndSize(bf_qty123, 10f); cb.SetTextMatrix(422,100); cb.ShowText("longstring"); cb.EndText(); ```

Original source

Related problems