Bruno,

I tried using the Chunk.setNewPage() method, but once I have added some
images to the first section, it no longer has any effect. When I add a
second section to the chapter using a Chunk and Chunk.setNewPage() as in
your example, it does not start on a new page. The string in the Chunk ends
up at the bottom of a page.

Kim

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Bruno
Sent: Wednesday, July 09, 2003 3:25 AM
To: Kim
Cc: [EMAIL PROTECTED]
Subject: RE: [iText-questions] newPage() and images

Kim,

I studied your code sample after your last mail.

I'm 99% sure I gave you the right answer yesterday.
Please take a look at this:

>       chapter = new Chapter(p,num);
>       chapter.setNumberDepth(0);
>       while (j.hasNext()) {
>         //newpage = doc.newPage();
>         sect = chapter.addSection(p,secNum);
>         p = new Paragraph("\n");
>         sect.add(p);
>         for (int k = 0; k < annlMsgs.size(); k++) {
>           chartClass = (String)(annlCharts.get(k));
>           chartName = msgs.getString("title.annual." +
> chartClass.substring(4,chartClass.indexOf("Chart")));
>           sect.add(createChart(conn, company, (String)(annlMsgs.get(k)),
> chartClass, chartName));

This won't work: the doc doesn't know about the section yet.
You should add a NEWPAGE chunk to the Section here:
sect.add(NEWPAGECHUNK);

>           doc.newPage();
>         }
>         for (int l = 0; l < qtrlyMsgs.size(); l++) {
>           chartClass = (String)(qtrlyCharts.get(l));
>           chartName = msgs.getString("title.qtrly." +
> chartClass.substring(5,chartClass.indexOf("Chart")));
>           sect.add(createChart(conn, company, (String)(qtrlyMsgs.get(l)),
> chartClass, chartName));

Same remark here.

>           doc.newPage();
>         }
>       }

All the doc.newPage() invocations were done BEFORE this happened:

>       doc.add(chapter);

replace doc.newPage() in your code with doc.add(new Paragraph("newPage"));
and you will see what I mean.


-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions



-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to