Page size and margins are only set after a newPage() that really creates a 
new page.

Paulo

----- Original Message ----- 
From: "svager" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, October 31, 2006 8:23 PM
Subject: [iText-questions] Page's Margins are not working


>
> There is something fummy going on with margins. I set them up for each 
> page
> but they won't take effect. Any ideas why ?
>
> Here is my code.
>
> import java.io.FileOutputStream;
> import java.io.IOException;
>
> import com.lowagie.text.*;
>
> import com.lowagie.text.Document;
> import com.lowagie.text.DocumentException;
> import com.lowagie.text.Paragraph;
> import com.lowagie.text.PageSize;
> import com.lowagie.text.pdf.PdfWriter;
>
> public class NewPDF {
>  public static final int RIGHT = 40;
>  public static final int LEFT = 40;
>  public static final int TOP = 40;
>  public static final int BOTTOM = 40;
>
>  public static void main(String[] args) {
>
>    System.out.println("Margins. May be ???");
>
>      Document document = new Document();
>      try {
>        PdfWriter.getInstance(document,
>            new FileOutputStream("pdfDoc.pdf"));
>        document.open();
>        document.setPageSize(PageSize.A4);
>        document.setMargins(LEFT, RIGHT, TOP, BOTTOM);
>        document.newPage();
>        Paragraph para=new Paragraph();
>        para.setAlignment(Element.ALIGN_JUSTIFIED);
>        para.add("Page 1. This PageSize is DIN A4.This PageSize is DIN A4."
> +
>            "This PageSize is DIN A4.This PageSize is DIN A4.This PageSize
> is DIN " +
>            "A4.This PageSize is DIN A4.");
>        document.add(para);
>        document.setMargins(LEFT, RIGHT, TOP, BOTTOM);
>        document.newPage();
>        para.clear();
>        para.add("Page 2. This PageSize is DIN A4.This PageSize is DIN A4."
> +
>        "This PageSize is DIN A4.This PageSize is DIN A4.This PageSize is
> DIN " +
>        "A4.This PageSize is DIN A4.");
>        document.add(para);
>      }
>      catch (DocumentException de) {
>            System.out.println(de.getMessage());
>      }
>      catch (IOException ioe) {
>           System.out.println(ioe.getMessage());
>      }
>  document.close();
> }
> }
> Thanks
> -- 
> View this message in context: 
> http://www.nabble.com/Page%27s-Margins-are-not-working-tf2548191.html#a7101913
> Sent from the iText - General mailing list archive at Nabble.com.
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job 
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> 


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to