MultiColumnText doesn't support multiple writers. The first writer consumes
all the text and nothing is left for the second writer.

----- Original Message ----- 
From: "Daniel Frey" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, July 28, 2005 11:24 AM
Subject: [iText-questions] Bug with MultiColumnText and
ByteArrayOutputStream?


> Hello
>
> I am new to iText and find it is a great product. Thanks to all those
> helping to develop it!
>
> I have come across a problem, which might turn out to be a bug (in my code
> or in iTexts). Consider the following code:
>
> final Document doc = new Document(PageSize.A4);
> final OutputStream stream1 = new FileOutputStream("C:/Temp/Test1.pdf");
> final PdfWriter writer1 = PdfWriter.getInstance(doc, stream1);
> final ByteArrayOutputStream stream2 = new ByteArrayOutputStream();
> final PdfWriter writer2 = PdfWriter.getInstance(doc, stream2);
> doc.open();
> doc.add(new Paragraph("Hallo"));
> final MultiColumnText cols = new MultiColumnText();
> cols.addRegularColumns(doc.left(), doc.right(), 10f, 3);
> for (int i = 0; i < 100; i++) {
>     cols.addElement(new Paragraph("Hallo"));
> }
> doc.add(cols);
> doc.close();
> writer1.close();
> writer2.close();
> final FileOutputStream fileStream = new
> FileOutputStream("C:/Temp/Test2.pdf");
> fileStream.write(stream2.toByteArray());
> fileStream.close();
> stream1.close();
> stream2.close();
>
> This code make two pdfs for the same document. However, whilst Test1.pdf
> does contain the columns added, Test2.pdf doesn't. What's wrong here?
>
> Thanks in advance
> Daniel Frey
>
>



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September
19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to