Hello. I'm begining with iText and just playing with the very first examples in the book I've stumbled with this: 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). Is it a bug, a feature or is there a mistake in my code? Thanks *//********************************** 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 document = new Document(PageSize.A4); try { PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("Salida2.pdf")); document.setMargins(50f,115f, 100f,100f); document.setMarginMirroring(true); document.open(); document.add(new Paragraph(textoParrafo("Esto es una prueba", 1300))); document.add(new Paragraph(textoParrafo("Esto está en el segundo párrafo", 300))); document.add(new Paragraph(textoParrafo("Esto está en el tercer párrafo", 130))); document.add(new Paragraph(textoParrafo("En este párrafo se produce un error ", 1300))); document.add(new Paragraph(textoParrafo("Esto es una prueba", 1300))); document.add(new Paragraph(textoParrafo("Esto está en el segundo párrafo", 300))); document.add(new Paragraph(textoParrafo("Esto está en el tercer párrafo", 130))); document.add(new Paragraph(textoParrafo("z", 55))); } catch (Exception e){ throw e; } document.close(); } /* returns filler text for paragraphs */ public static String textoParrafo(String cadena, int longitud){ String resultado = cadena; if (resultado.equals("")) { resultado = "x x x x x x x x x x x x x x x x "; } if (resultado.charAt(resultado.length()-1) != ' ') { resultado += ' '; } while (resultado.length()<longitud) { resultado += resultado ; } return resultado.substring(0,longitud); } } //********************************** *
salida2.pdf
Description: Adobe PDF document
------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net 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