import java.io.FileOutputStream;
import java.io.IOException;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.PageSize;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfWriter;
public class MirroringMarginsPDF {
public static void main(String[] args) {
Document document = new Document(PageSize.A5, 36, 72, 108, 180);
try {
PdfWriter.getInstance(document, new FileOutputStream("MirroringMarginsPDF.pdf"));
document.open();
document.add(new Paragraph("paragraph"));
document.setMarginMirroring(true);
document.add(new Paragraph("Starting on the next page, the margins will be mirrored."));
for (int i = 0; i < 60; i++) {
document.add(new Paragraph("paragraph"));
}
} catch (DocumentException de) {
System.err.println(de.getMessage());
} catch (IOException ioe) {
System.err.println(ioe.getMessage());
}
document.close();
}
}
itext.zip( 1,748 k)