Gustaf Andersson wrote:
>I haven't confirmed this (no time) but I think u have to do this instead:
>
> // step 3: we open the document
> document.open();
> document.setPageSize(PageSize.A4.rotate());
>
> // step 4: we add some content
> document.add(new Paragraph("To create a document in
>landscape format, just make the height smaller than the width. For
>instance by rotating the PageSize Rectangle: PageSize.A4.rotate()"));
> document.newPage();
> document.setPageSize(PageSize.A4);
> document.add(new Paragraph("This is portrait again"));
>
>hope this helped
>regards Gustaf
>
>Josep Miquel Garcia Rodriguez wrote:
>
>
>
>>Hi all,
>>
>>I'm new in this list, after searching a litle in archives I can't find
>>anything about that.
>>
>>I think this is a bug.
>>Here the code:
>>
>> Document document = new Document();
>>
>> try {
>>
>> // step 2:
>> // we create a writer that listens to the document
>> // and directs a PDF-stream to a file
>>
>> PdfWriter.getInstance(document, new
>>FileOutputStream("c:\\testLib.pdf"));
>>
>> // step 3: we open the document
>> document.open();
>> document.setPageSize(PageSize.A4.rotate());
>> document.newPage();
>>
>>
>
>newPage wont add newPage if the page is empty...
>
>
>
>>
>> // step 4: we add some content
>> document.add(new Paragraph("To create a document in
>>landscape format, just make the height smaller than the width. For
>>instance by rotating the PageSize Rectangle: PageSize.A4.rotate()"));
>> document.setPageSize(PageSize.A4);
>>
>>
>
>Sets the size of the current page i.e. the one u just added the previos
>paragraph to
>
>
>
Sorry, my comment here is not correct, this set the size of the next
page in the document. the problem u have is that newPage() does not
create a new page when the page is empty...
>> document.newPage();
>> document.add(new Paragraph("This is portrait again"));
>>
>> }
>> catch(DocumentException de) {
>> System.err.println(de.getMessage());
>> }
>> catch(IOException ioe) {
>> System.err.println(ioe.getMessage());
>> }
>>
>> // step 5: we close the document
>> document.close();
>>The first page is not landscape, but portrait.
>>
>>I know that you can do:
>>
>> Document document = new Document(PageSize.A4.rotate());
>>and then it works well. But in my case I can't use tha way.
>>
>>Greetings
>>
>>
>
>
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by:
>Power Architecture Resource Center: Free content, downloads, discussions,
>and more. http://solutions.newsforge.com/ibmarch.tmpl
>_______________________________________________
>iText-questions mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/itext-questions
>
>
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions