itext pdf PageSize.LEGAL_LANDSCAPE.rotate() does not print <p>I have created a program to write pdf having two page, first page is portrait and second one is landscape. It creates pdf but when I print that file it does not print second page i.e. landscape page.</p> <p>Below is my code</p> <pre><code>/******************/ import com.itextpdf.text.Document; import com.itextpdf.text.DocumentException; import com.itextpdf.text.Element; import com.itextpdf.text.PageSize; import com.itextpdf.text.Paragraph; import com.itextpdf.text.pdf.PdfWriter; import java.io.FileNotFoundException; import java.io.FileOutputStream; public class TestPDF { public static void main(String args[]) throws DocumentException, FileNotFoundException { Document document = new Document(); PdfWriter.getInstance(document, new FileOutputStream("/home/devang/test.pdf")); document.setMargins(10.0f, 10.0f, 20.0f, 2.0f); document.open(); //PAGE1 addFirstPage(document); //PAGE2 addSecondPage(document); document.close(); } public static Document addFirstPage(Document document) throws DocumentException { document.addTitle("Test PDF"); Paragraph paragraph = new Paragraph(); paragraph.setAlignment(Element.ALIGN_CENTER); paragraph.add("Page 1"); paragraph.add("\nPage 1"); paragraph.add("\nPage 1"); paragraph.add("\nPage 1"); paragraph.add("\nPage 1"); document.add(paragraph); return document; } public static Document addSecondPage(Document document) throws DocumentException { document.setPageSize(PageSize.LEGAL_LANDSCAPE.rotate()); document.newPage(); document.addTitle("Test PDF"); Paragraph paragraph = new Paragraph(); paragraph.setAlignment(Element.ALIGN_CENTER); paragraph.add("Page 2"); paragraph.add("\nPage 2"); paragraph.add("\nPage 2"); paragraph.add("\nPage 2"); paragraph.add("\nPage 2"); document.add(paragraph); return document; } } </code></pre> <p>Thanks in advance.</p>