I can reproduce the problem with the following program:

document.setPageSize(PageSize.A4.rotate());
document.open();
Table t = new Table(5);
t.setWidth(100);
for (int k = 0; k < 500; ++k)
    t.addCell("" + k);
document.setPageSize(PageSize.A4);
document.add(t);
document.close();

What happens is that the table width is set in page 1 (landscape) and
extends to the other pages (portrait) keeping the dimensions of the
first page. I don't know if I should consider it a bug, a table changing
width between pages is probably not what you want either.
The solution is to only do any page size changes after
document.add(table).

Best Regards,
Paulo Soares

> -----Original Message-----
> From: Graham Leggett [mailto:[EMAIL PROTECTED] 
> Sent: Friday, March 26, 2004 9:45 AM
> To: Paulo Soares
> Subject: Re: [iText-questions] Switching from landscape to 
> portrait to landscape again - broken
> 
> Paulo Soares wrote:
> 
> > That's weird. You can send me a small code example so that I can
> > reproduce here the problem.
> 
> I've attached a copy of the PDF file, I would appreciate it 
> if you could 
> keep it confidential.
> 
> The code to create it is attached.
> 
> Inside PremiumBordereauReport around line 231, the method 
> makeSectionSummary() creates the portrait pages, and the method 
> makePremiumBordereau() creates the landscape pages.
> 
> The object "Report" is extended by "PremiumBordereauReport" 
> and has the 
> helper apps.
> 
> If you can tell me what's wrong, I would hugely appreciate it...
> 
> Regards,
> Graham
> --
> 
> >>-----Original Message-----
> >>From: [EMAIL PROTECTED] 
> >>[mailto:[EMAIL PROTECTED] On 
> >>Behalf Of Graham Leggett
> >>Sent: Thursday, March 25, 2004 4:58 PM
> >>To: [EMAIL PROTECTED]
> >>Subject: [iText-questions] Switching from landscape to 
> >>portrait to landscape again - broken
> >>
> >>Hi all,
> >>
> >>I have an iText app linked against v1.02b that is 
> demonstrating some 
> >>weirdness.
> >>
> >>I have a document containing pages that alternate between 
> >>portrait and 
> >>landscape. Page 1 is portrait, this works fine. Page 2 and 3 are 
> >>landscape, this works fine. Page 4 is supposed to be portrait 
> >>again, and 
> >>this is where things go pear shaped.
> >>
> >>Page 4 is rendered landscape, but with the content of the page in 
> >>portrait. As the content won't fit onto the page (it's 
> >>chopped off about 
> >>2/3 of the way) it runs onto a second page. This second 
> page, Page 5, 
> >>rendered in portrait, with the rest of page 4, still rendered in 
> >>landscape on it.
> >>
> >>Page 6 is landscape again, and works fine. Any further 
> portrait pages 
> >>have the same problem.
> >>
> >>When the page 4 is rendered, and the flip from landscape back to 
> >>portrait accurs, the code goes like this:
> >>
> >>            /* set up the document */
> >>    document.setPageSize(PageSize.A4);
> >>
> >>    /* create a footer for this document */
> >>    document.setFooter("footer string");
> >>
> >>    /* open the document */
> >>    if (document.isOpen()) {
> >>            document.newPage();
> >>    } else {
> >>            document.open();
> >>    }
> >>
> >>When any of the landscape pages are rendered, the code goes 
> like this:
> >>
> >>    /* set up the document */
> >>    document.setPageSize(PageSize.A4.rotate());
> >>
> >>    /* create a footer for this document */
> >>    document.resetFooter();
> >>
> >>    /* open the document */
> >>    if (document.isOpen()) {
> >>            document.newPage();
> >>    } else {
> >>            document.open();
> >>    }
> >>
> >>The second piece of code works, the first does not. Does 
> >>anybody know why?
> >>
> >>While I was using an old v0.99-era version of iText, this 
> >>problem would 
> >>occur every now and again randomly. Now that I am using 
> v1.02b, this 
> >>problem happens all the time.
> >>
> >>I can show an example PDF, but I will have to mail it 
> >>privately, as it 
> >>contains confidential info.
> 
> 


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to