title: iText Document : Rotate the page
body: <p>After the rotation of the document I lose the order of my data in the page :    </p>
  
  <pre><code>package com.mkyong.common.view;
  
  
      import java.io.File;
      import java.io.IOException;
      import java.util.Map;
      import javax.servlet.http.HttpServletRequest;
      import javax.servlet.http.HttpServletResponse;
      import org.springframework.web.servlet.view.document.AbstractPdfView;
      import com.lowagie.text.Document;
      import com.lowagie.text.DocumentException;
      import com.lowagie.text.PageSize;
      import com.lowagie.text.Table;
      import com.lowagie.text.pdf.PdfWriter;
      import com.lowagie.text.Image;
      public class PdfRevenueReportView extends AbstractPdfView{
  
          @Override
          protected void buildPdfDocument(Map model, Document document,
              PdfWriter writer, HttpServletRequest request,
              HttpServletResponse response) throws Exception {
  
              Image im= Image.getInstance("D:\\tree2.png");
               // setSize
               im.scaleToFit(130, 150);
  
  
              Map&lt;String,String&gt; revenueData = (Map&lt;String,String&gt;) model.get("revenueData");
  
              Table table = new Table(2);
              table.addCell("Month");
              table.addCell("Revenue");
  
              for (Map.Entry&lt;String, String&gt; entry : revenueData.entrySet()) {
                  table.addCell(entry.getKey());
                  table.addCell(entry.getValue());
                      }
              document.setPageSize(PageSize.A4.rotate());
              document.newPage();
              document.add(im);
              document.add(table);
  
          } 
      }
  </code></pre>
  
  <p>give me this :</p>
  
  <p><img src="https://i.stack.imgur.com/AU1EJ.png" alt="enter image description here"></p>
  
  <p>and when i change the  position of these two lines : </p>
  
  <pre><code>document.setPageSize(PageSize.A4.rotate());
  document.newPage();
  </code></pre>
  
  <p>it return to the default position. Where is the problem ?</p>
  
  <p>Thank you.</p>