Hello,

 

For some strange reason, when a new page is created the margin seems to be pushed down & does not line up w/ the first page. I’ve checked the top margin while running through the loop to see if it changes. But it stays the same. Even if I manually change the margin after the new page is created, the space is still there. My pseudo code follows. Any help would be greatly appreciated.

 

Thank you,

Jason DiMeo

[EMAIL PROTECTED]

 

import java.io.FileOutputStream;

import java.io.IOException;

import java.awt.Color;

import java.awt.Point;

 

import com.lowagie.text.*;

import com.lowagie.text.pdf.*;

 

public class test

{

            public static void main(String[] args) throws Exception

            {          

                        Document.compress = false;                             

              Document doc = new Document(PageSize.A4, 20, 20, 44, 36);

              try

              {

                        PdfWriter pdfWriter = PdfWriter.getInstance(doc, new FileOutputStream("a.pdf"));              

                                   

                                    doc.open();

                                    for (int i=1; i<5; i++)

                                    {                                         

                                                System.out.println(doc.topMargin());

                                                Phrase phr = new Phrase("this is a test", FontFactory.getFont(FontFactory.HELVETICA, 16, Font.NORMAL));                                                                       

                                                doc.add(phr);

                                                doc.newPage();                                     

                                                //doc.setMargins(0, 0, 0, 0);                       

                                    }

                        }

              catch(DocumentException de)

              {

                System.err.println(de.getMessage());

              }

              catch(IOException ioe)

              {

                System.err.println(ioe.getMessage());

              }

              doc.close();

            }

}

Reply via email to