Hello.
I'm sorry if I'm misusing this list.
If that's the case, then, please, tell me what's the matter.
Some days ago I send this question but, to this moment there isn't any answer...
Thanks in advance.

This is the original question:
----------------------------------------

I'm begining with iText and, just playing with the very first examples
in the book, I've stumbled with this problem:
when you set margin mirroring to true and then you add Paragraphs
enough to reach the end of the page,
then, if a Paragraph spans from a page to the following one, the first
line written in the second page has
wrong left and right margins (not mirrored margins).
Is it a bug, is it a feature or is there a mistake in my code?

Thanks


This is the code:


   import com.itextpdf.text.*;
   import com.itextpdf.text.pdf.*;
   import java.io.FileOutputStream;
   import java.io.IOException;

   public class Segundo {

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

       Document.compress = false;
       Document doc = new Document(PageSize.A4);

       try {
               PdfWriter writer = PdfWriter.getInstance(doc, new
FileOutputStream("Salida2.pdf"));
               doc.setMargins(50f,115f, 100f,100f);
               doc.setMarginMirroring(true);
               doc.open();
               doc.add(new Paragraph(paragraphFiller("This is a test", 1300)));
               doc.add(new Paragraph(paragraphFiller("This is the
second Paragraph", 300)));
               doc.add(new Paragraph(paragraphFiller("This is the
third Paragraph", 130)));
               doc.add(new Paragraph(paragraphFiller("The error is in
this Paragraph", 1300)));
               doc.add(new Paragraph(paragraphFiller("This is still
the test", 1300)));
               doc.add(new Paragraph(paragraphFiller("This is very
boring", 300)));
               doc.add(new Paragraph(paragraphFiller("Yes, it is!", 130)));
               doc.add(new Paragraph(paragraphFiller("The End", 55)));
       }
       catch (Exception e){
           throw e;
       }

       doc.close();

       }



     /* returns filler text for paragraphs */

     public static String paragraphFiller(String str, int leng){

         String result = str;

         if (result.equals(""))  {  result = "x x x x x x x x x x x x
x x x x "; }       // default value

         if (result.charAt(result.length()-1) != ' ')  {  result +='
';  }                      // add separator space

         while (result.length()<leng)   {  result += result ;  }

         return result.substring(0, leng);

 }



}

   //**********************************

------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to