Re: [iText-questions] Problem in nesting of lists in RTF?

2009-11-17 Thread Scott Miller
I believe a related bug has been filed:

http://sourceforge.net/tracker/?func=detailaid=2802486group_id=15255atid=115255

They're using the HtmlWorker, but I'm guessing the root cause is just
in the RTF generation.  I see the same behavior that you are in one of
our test cases.  However, we're not currently using sub lists in our
product (so I haven't looked at fixing it myself, yet).  If you're
able to fix the source code, and submit a patch - well, that would be
awesome.  :)

I have a couple of similar outstanding patches - maybe when the
project goes into incubator mode, they'll get merged in.

btw - thanks to Bruno, Howard, et al, the RTF support does go a pretty
long way.  And if you're willing to fix a couple things here and there
for your specific uses - you can do a lot with it.

Cheers,
Scott


On Mon, Nov 16, 2009 at 9:51 PM, Chris von See ch...@techadapt.com wrote:
 Thanks for the information.  I'm a newbie to the list and hadn't seen
 Bruno's earlier post.

 Chris von See
 Senior Geek
 TechAdapt, Inc.
 http://www.techadapt.com
 ch...@techadapt.com

 Save trees.  Print only when necessary.





 On Nov 16, 2009, at 6:42 PM, mister bean wrote:


 Per Bruno's earlier post to this list, iText is moving to PDF-only for
 output. The incubator is for related projects that developers might
 want to
 use in conjunction with iText. Whether that means they're dead or
 alive will
 depend, I am sure, on the authors of the various packages.

 If Howard Shenk is reading the list, he might be able to tell you/us
 directly what involvement he anticipates regarding maintenance and
 development of the RTF package.

 Regards,

 ---mr. bean



 Chris von See wrote:

 Well, that wasn't quite the answer I had hoped for :/

 Will iText RTF support emerge from the incubator at some point in the
 future? or is this a death by incubation scenario?

 Chris


 On Nov 16, 2009, at 2:37 PM, mister bean wrote:


 iText is about to move the RTF functionality to an incubator and
 deprecate
 this functionality. Unless someone can provide the answer on this
 list (and
 even if they do), you might want to consider other options for RTF
 generation.

 Best wishes,

 ---mr. bean

 re 



 Chris von See wrote:

 I think I've found a problem with nesting of lists in RTF.  Running
 the program below with PDF output produces nested lists three
 levels
 deep with all sub-lists nested properly.  However, if you run the
 same
 code with RTF output the third level of lists does not show as
 being
 indented, although the numbering seems correct.  Is there something
 that needs to be done differently for RTF?

 Thanks,
 Chris

 Test program:

 import java.io.FileOutputStream;
 import java.io.IOException;

 import com.lowagie.text.Chunk;
 import com.lowagie.text.Document;
 import com.lowagie.text.DocumentException;
 import com.lowagie.text.List;
 import com.lowagie.text.ListItem;
 import com.lowagie.text.pdf.PdfWriter;
 import com.lowagie.text.rtf.RtfWriter2;


 public class TestList {

        public static void main(String[] args) throws IOException,
 DocumentException {
                Document document = new Document();
                RtfWriter2.getInstance(document, new
 FileOutputStream(testlist.rtf));
 //                PdfWriter.getInstance(document, new
 FileOutputStream(testlist.pdf));
                document.open();
                List list1 = new List(List.ALPHABETICAL, 20);
        list1.add(new ListItem(new Chunk(Level 1 - Item 1)));
        list1.add(new ListItem(new Chunk(Level 1 - Item 2)));
        list1.add(new ListItem(new Chunk(Level 1 - Item 3)));

        List list2 = new List(List.ORDERED, 20);
        list2.add(new ListItem(new Chunk(Level 2 - Item 1)));
        list2.add(new ListItem(new Chunk(Level 2 - Item 2)));

        List list3 = new List(List.ORDERED, 20);
        list3.add(new ListItem(new Chunk(Level 3 - Item 1)));
        list3.add(new ListItem(new Chunk(Level 3 - Item 2)));
        list3.add(new ListItem(new Chunk(Level 3 - Item 3)));
        list3.add(new ListItem(new Chunk(Level 3 - Item 4)));
        list2.add(list3);

        //list2.add(new ListItem(new Chunk(Level 2 - Item 3)));
        list1.add(list2);

        list1.add(new ListItem(new Chunk(Level 1 - Item 4)));

        document.add(list1);
                document.close();
        }
 }

 PDF output:



 RTF output:





 --
 Let Crystal Reports handle the reporting - Free Crystal Reports
 2008
 30-Day
 trial. Simplify your report design, integration and deployment -
 and focus
 on
 what you do best, core application coding. Discover what's new with
 Crystal Reports now.  http://p.sf.net/sfu/bobj-july
 ___
 iText-questions mailing list
 iText-questions@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/itext-questions

 Buy the iText book: http://www.1t3xt.com/docs/book.php
 Check the site with examples 

Re: [iText-questions] rtf headings in multiple threads

2009-06-03 Thread Scott Miller
Just wanted to follow up - sorry if this whole issue seems a little on
the fringe.

Unless there is a better solution than below, could we get the small
required change into the next release?

To com.lowagie.text.rtf.document.RtfDocumentSettings.java, I added:

public RtfParagraphStyle getRtfParagraphStyle(String styleName) {
   return this.document.getDocumentHeader().getRtfParagraphStyle(styleName);
}

Any suggestions appreciated.

Cheers,
Scott

On Wed, May 20, 2009 at 1:50 PM, Scott Miller scott.a.mil...@gmail.com wrote:
 Hi Everyone,

 I'm working on a deployment of iText that will be generating multiple
 reports, possibly on multiple threads.  My understanding is that all
 of the mutable state of the document and writer objects are
 self-contained.  If that's true, I believe that it should be fine for
 multiple threads to work simultaneously - so long as each thread is
 working on its own writer object.

 One exception that I do see is the manipulation of the rtf heading
 paragraph styles.

 According to:
 http://itextdocs.lowagie.com/tutorial/rtf/features/styles/index.php

 you can change the font size, style, etc. of the paragraph headings by
 manipulating some global Font objects.  This seems problematic - not
 just for multiple threads - but for generating multiple reports within
 the same jvm; e.g. one report assumes the defaults are set, after
 another has changed them.

 I came up with a solution - which might be an awful hack, but it seems
 to work.  To RtfDocumentSettings.java, I added:

  public RtfParagraphStyle getRtfParagraphStyle(String styleName) {
    return this.document.getDocumentHeader().getRtfParagraphStyle(styleName);
  }

 Then (after opening the document) I can modify the heading font for a
 specific report with:

 RtfParagraphStyle headerStyle =
 writer.getDocumentSettings().getRtfParagraphStyle(heading 1);
 headerStyle.setSize(14f);

 Since registerParagraphStyle clones the global object specifically for
 the document, this approach solves the shared object problem.  I
 understand that there can only be one style for the entire document
 (last one wins I believe), and that's ok.

 So - I have two questions:

 1. Is there a reason why the above should be avoided?
 2. Are there any other known places where things might not be
 thread-safe?  (I googled for this, and the answer was no, but want to
 double-check, especially in light of my unusual use case above)

 One other constraint is that I must use these heading styles, because
 I am also using them in the table of contents.  Any advice is
 appreciated.

 Cheers,
 Scott


--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/


[iText-questions] rtf headings in multiple threads

2009-05-20 Thread Scott Miller
Hi Everyone,

I'm working on a deployment of iText that will be generating multiple
reports, possibly on multiple threads.  My understanding is that all
of the mutable state of the document and writer objects are
self-contained.  If that's true, I believe that it should be fine for
multiple threads to work simultaneously - so long as each thread is
working on its own writer object.

One exception that I do see is the manipulation of the rtf heading
paragraph styles.

According to:
http://itextdocs.lowagie.com/tutorial/rtf/features/styles/index.php

you can change the font size, style, etc. of the paragraph headings by
manipulating some global Font objects.  This seems problematic - not
just for multiple threads - but for generating multiple reports within
the same jvm; e.g. one report assumes the defaults are set, after
another has changed them.

I came up with a solution - which might be an awful hack, but it seems
to work.  To RtfDocumentSettings.java, I added:

  public RtfParagraphStyle getRtfParagraphStyle(String styleName) {
return this.document.getDocumentHeader().getRtfParagraphStyle(styleName);
  }

Then (after opening the document) I can modify the heading font for a
specific report with:

RtfParagraphStyle headerStyle =
writer.getDocumentSettings().getRtfParagraphStyle(heading 1);
headerStyle.setSize(14f);

Since registerParagraphStyle clones the global object specifically for
the document, this approach solves the shared object problem.  I
understand that there can only be one style for the entire document
(last one wins I believe), and that's ok.

So - I have two questions:

1. Is there a reason why the above should be avoided?
2. Are there any other known places where things might not be
thread-safe?  (I googled for this, and the answer was no, but want to
double-check, especially in light of my unusual use case above)

One other constraint is that I must use these heading styles, because
I am also using them in the table of contents.  Any advice is
appreciated.

Cheers,
Scott

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/