3

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();
Dhaval Patel
  • 7,471
  • 6
  • 37
  • 70

1 Answers1

3

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?

Community
  • 1
  • 1
lamy
  • 56
  • 3
  • Not sure why this was downvoted, this is nearly identical to the code I use to wrap text in my project. – quip Feb 05 '13 at 16:51