c# - Using iTextSharp, is there a way to keep text from staying in a rectangle -
i have existing pdf (not form fields - more of scanned document), , using pdfreader load pdf "template" write text on it.
for position simple fields using:
pdfreader reader = new pdfreader(templatepath); chunk chunk = new chunk(text, fonttouse); phrase phrase = new phrase(); phrase.add(chunk); pdfcontentbyte canvas = this.pdfwriter.directcontent; columntext.showtextaligned(this.pdfcontentbyte, alignment, phrase, left, top, 0); i need write text specific area 400 x 200 rectangle. since size of text varies, may or may not fit rectangle.
is there way write text rectangle, , if text large not appear (like overflow hidden work in html)?
got it!
phrase mytext = new phrase(text); pdfptable table = new pdfptable(1); table.totalwidth = 300; table.lockedwidth = true; pdfpcell cell = new pdfpcell(mytext); cell.border = 0; cell.fixedheight = 40; table.addcell(cell); table.writeselectedrows ( 0, -1, 300, 700, writer.directcontent );
Comments
Post a Comment