It probably doesn't work. The recommended way is to put the text inside a PdfPTable with a single column and no padding and with split rows false.
Paulo ----- Original Message ----- From: "Michael McCall" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Tuesday, August 21, 2007 8:36 PM Subject: [iText-questions] Keeping Text Together To Whom It May Concern: I am currently developing a web application that uses Spring Framework and iText to take in values (through a series of forms) and generate a PDF letter from them. The length of the body of my letter is dynamic, but I want the closing of my letter to always stay together on one page. I have a Java class with the following code in it: String x = firstName + " " + lastName + "\n" + title; Paragraph closing = new Paragraph("Sincerely,\n\n\n\n" + x + "\nEndeca Technologies, Inc."); closing.setKeepTogether(true); document.add(closing); Simply put: it's not working. As the document changes based on user input, the paragraph often splits to two pages, putting "Sincerely," at the end of one page and stranding the rest of the text on the following page. I even printed the value of "closing.getKeepTogether()" in the PDF to double-check, and it does in fact say "true." I am not having any other problems with my app currently, so I don't think there are any configuration problems that might be behind this. I looked through the documentation and the mailing list archives, and I could not find any examples or related problems. I've seen your "How deep is blue?" FAQ, so I hate to ask such a vague question, but...why doesn't it work? Really, I am looking for any suggestions you might have or for you to tell me that it's actually just a bug you're fixing for the next version. Thanks. ___________________________ Michael McCall IT Intern T 617.674.6330 M 860.967.6178 [EMAIL PROTECTED] Endeca 101 Main Street, 14th Floor Cambridge, MA, 02142 www.endeca.com <http://www.endeca.com/> find / analyze / understand ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/
