Hi,

We've been using iText in our product and it's done a great job!
However, I noticed that when generating a RTF document with Chapters,
a page break is made after the Chapter title. This results in many
allmost empty pages and alot of work editing the document afterwards.

Section class has a method setTriggerNewPage() but this does not seem
to work with RTF (atleast not as I expected). So, after browsing the RTF
spec from M$ [1], I tried inserting \sbknone in  
RtfChapter.writeContent()
According to the spec, Section break starts a new page by default,  
inserting
\sbknone seems to behave as I wanted (content after the Chapter is not  
shifted
onto a new page.

The fix is quite crude, and not controlled by setTriggerNewPage(). I'm  
not sure
if this is the correct way to get the result, any comments?

Best regards,

Kimmo Koskinen

[1] 
http://www.microsoft.com/downloads/details.aspx?FamilyId=DD422B8D-FF06-4207-B476-6B5396A18A2B&displaylang=en
     page 79

Index: src/rtf/com/lowagie/text/rtf/text/RtfChapter.java
===================================================================
--- src/rtf/com/lowagie/text/rtf/text/RtfChapter.java   (revision 3315)
+++ src/rtf/com/lowagie/text/rtf/text/RtfChapter.java   (working copy)
@@ -88,6 +88,7 @@
          }
          result.write("\\sectd".getBytes());
          document.getDocumentHeader().writeSectionDefinition(result);
+        result.write("\\sbknone".getBytes());
          if(this.title != null) {
              this.title.writeContent(result);
          }



-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar

Reply via email to