I would like to add a gutter to an existing document, but if I apply
setMargins it has no effect (do not want to use MirrorMargins).
Can anybody tell me what is wrong about the following source?

   int gutter = (int)( 5 *72 / 25.4 );
   left = (int)(0.333 * 72); right = left;
   top = (int)(0.5 * 72 - 0.5 * gutter);
   if(top<0) top=0;
   bottom = top;

     Document doc = new Document(pagesize);
     PdfCopy copy = new PdfCopy(doc,new FileOutputStream(destfile));
     doc.open();
     PdfImportedPage page;
     boolean odd = true;

     for(String srcfile : srcfiles)  {
       PdfReader reader = new PdfReader(srcfile);
       int pages = reader.getNumberOfPages();
       for(int i=1; i<=pages; i++) {
           if(odd) copy.setMargins(left,right,top+gutter,bottom);
              else copy.setMargins(left,right,top,bottom+gutter);
           if(odd) doc.setMargins(left,right,top+gutter,bottom);
              else doc.setMargins(left,right,top,bottom+gutter);
         page = copy.getImportedPage(reader,i);
           if(odd) copy.setMargins(left,right,top+gutter,bottom);
              else copy.setMargins(left,right,top,bottom+gutter);
           if(odd) doc.setMargins(left,right,top+gutter,bottom);
              else doc.setMargins(left,right,top,bottom+gutter);
         copy.addPage(page);
         odd = ! odd;
       }
     }
     doc.close();

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to