I am currently using ITextSharp, and following along with IText in Action Second edition, specifically page 74 working with the ColumnText object.
I am loading a PDF file using the PDFReader and PDFStamper classes, and trying to add multiple Elements in the PDF document.
PdfStamper pdfStamper = new PdfStamper(pdfReader, fileStream);
PdfContentByte canvas = pdfStamper.GetOverContent(1);
Rectangle size = pdfReader.GetPageSizeWithRotation(1);
ColumnText ct = new ColumnText(canvas);
//I have multiple calls like below, with different x,y coords
ct.SetSimpleColumn(10, 634, 100, 642);
ct.AddText(new Chunk("1234567890 999 9 9 999000 0 877"));
ct.Go();
What I am noticing is the text will stop and then start writing over itself (the same column?). I basically need it to just stop when it gets to the end of the boundary. I do not need the extra text to show in another column.
I have read about the ColumnText.HasMoreText check, and also what the Go() returns. In this case, it will return NO_MORE_COLUMNS which I think is 2.
I am not understanding how to get the truncating to work correctly without the text writing on top of itself.
The text displays as "019 298397 4795 69 7989990000" which you can see it starts to overwrite on itself.
If anyone can assist me with this Id appreciate it. If i need clarification, let me know too.