import java.io.FileOutputStream;
import com.lowagie.text.Document;
import com.lowagie.text.Element;
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.A5, 36, 72, 108, 180);
PdfWriter.getInstance(document, new FileOutputStream(
"MirroredMargins.pdf"));
document.setMarginMirroring(true);
document.open();
document.add(new Paragraph("this is a test"));
Paragraph paragraph = new Paragraph();
paragraph.setAlignment(Element.ALIGN_JUSTIFIED);
for (int i = 0; i < 20; i++) {
paragraph.add("Hello World");
}
document.add(paragraph);
document.add(new Paragraph("this is a test"));
document.close();
}
}