PageSize.LETTER.rotate() : Page Size « PDF « Java Tutorial






import java.io.FileOutputStream;

import com.lowagie.text.Document;
import com.lowagie.text.PageSize;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfWriter;

public class MainClass {

  public static void main(String[] args) throws Exception {
    Document document = new Document(PageSize.LETTER.rotate());
    PdfWriter.getInstance(document, new FileOutputStream("1.pdf"));
    document.open();
    document.add(new Paragraph("Hello World"));
    document.close();
  }
}








29.23.Page Size
29.23.1.Some information on the page size
29.23.2.Set page size to LETTER, the orientation to Landscape
29.23.3.PageSize.LETTER.rotate()
29.23.4.PageSize.LETTER
29.23.5.A custom pagesize