Create you pdf normally. After that see the handout example on how to place and rotate the pages. I received a contribution to do something like that to reorder the pages.
Best Regards, Paulo Soares ----- Original Message ----- From: "mac fraser" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, September 11, 2004 21:41 Subject: [iText-questions] Rotating a table 180 degrees? > Hi, > > I am currently working on creating a booklet that will > be folded and center stapled. In order to facillitate > printing it would require some of the tables included > to be rotated 180 degrees (i.e. upside down on the > page). Is there a way to create the table and rotate > before placing in on the page? > > The only way I can think of doing this is using > templates, but is it possible to add a table to the > template? Are there other alternatives? > > Thanks in advance for your help. > Mac Fraser > > > > __________________________________ > Do you Yahoo!? > New and Improved Yahoo! Mail - Send 10MB messages! > http://promotions.yahoo.com/new_mail > > > ------------------------------------------------------- > This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170 > Project Admins to receive an Apple iPod Mini FREE for your judgement on > who ports your project to Linux PPC the best. Sponsored by IBM. > Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php > _______________________________________________ > iText-questions mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/itext-questions
/* * pdfBook.java * pdfBook * * Created by Tony Christney on 09/08/2004. * Copyright (c) 2004 Tony Christney. * * This program is distributed under the same licence as the * iText project. * * See http://sourceforge.net/projects/itext/ for details. */ /* * Based in part on concat_pdf.java from the iText project. * The file concat_pdf.java contains the following notice: * * This class by Mark Thompson. Copyright (c) 2002 Mark Thompson. * * This code is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * [EMAIL PROTECTED] */ /* * Based in part on psbook.c from the psutils package. * The file psbook.c contains the following notice: * * Copyright (C) Angus J. C. Duggan 1991-1995 */ import java.util.*; import java.io.*; import com.lowagie.text.Document; import com.lowagie.text.Chunk; import com.lowagie.text.pdf.*; /** * This class creates a booklet format PDF from an existing PDF. * * Arguments: [-ssignature] [-q] infile outfile * * q - Quiet mode. Do not print any message during execution. * * s - Signature. This must be a multiple of four. */ public class pdfBook { private static void usage() { System.err.println("arguments: [-ssignature] [-q] infile outfile"); } public static void main (String args[]) { if (args.length < 2) { usage(); return; } try { ArrayList master = new ArrayList(); int arg = 0; boolean quiet = false; int signature = 0; int maxpage = 0; int pages = 0; Document emptyPageDoc = null; PdfWriter emptyPageWriter = null; PdfReader emptyPageReader = null; File emptyPageFile = null; Document document = null; PdfCopy writer = null; PdfReader reader = null; // parse options while ( args[arg].charAt(0) == '-' ) { switch( args[arg].charAt(1) ) { case 's': signature = Integer.parseInt( args[arg].substring(2) ); if ( signature % 4 != 0 ) { System.err.println( "Signature must be a multiple of four!"); return; } break; case 'q': quiet = true; break; default: System.err.println( "Unknown option " + args[arg] + " ignored" ); break; } arg++; } // we create a reader for a certain document reader = new PdfReader(args[arg]); reader.consolidateNamedDestinations(); // we retrieve the total number of pages pages = reader.getNumberOfPages(); if ( signature == 0 ) { signature = maxpage = pages+(4-pages%4)%4; } else { maxpage = pages+(signature-pages%signature)%signature; } List bookmarks = SimpleBookmark.getBookmark(reader); if (bookmarks != null) { master.addAll(bookmarks); } if ( ! quiet ) { System.out.println("There are " + pages + " pages in " + args[arg]); System.out.println("Using a signature of " + signature + "."); } // create a document with an empty page emptyPageFile = File.createTempFile( "pdfbook","tmp" ); emptyPageDoc = new Document(reader.getPageSizeWithRotation(1)); emptyPageWriter = PdfWriter.getInstance( emptyPageDoc, new FileOutputStream(emptyPageFile.getAbsolutePath())); emptyPageDoc.open(); emptyPageDoc.add( new Chunk("") ); emptyPageDoc.close(); // delete the emptyPageFile on VM exit - call here in case of exceptions later emptyPageFile.deleteOnExit(); // open the empty page emptyPageReader = new PdfReader(emptyPageFile.getAbsolutePath()); // step 1: creation of a document-object document = new Document(reader.getPageSizeWithRotation(1)); // step 2: we create a writer that listens to the document writer = new PdfCopy(document, new FileOutputStream(args[arg+1])); // step 3: we open the document document.open(); // step 4: we add content PdfImportedPage page; // this reordering algorithm comes directly from psbook.c for ( int currentpg = 0; currentpg < maxpage; currentpg++) { int actualpg = currentpg - currentpg%signature; switch(currentpg%4) { case 0: case 3: actualpg += signature-1-(currentpg%signature)/2; break; case 1: case 2: actualpg += (currentpg%signature)/2; break; } if (actualpg < pages) { page = writer.getImportedPage(reader, actualpg + 1); writer.addPage(page); } else { page = writer.getImportedPage(emptyPageReader, 1); writer.addPage(page); } if ( ! quiet ) { System.out.println("Processed page " + (actualpg + 1)); } } PRAcroForm form = reader.getAcroForm(); if (form != null) { writer.copyAcroForm(reader); } if (master.size() > 0) { writer.setOutlines(master); } // step 5: we close the document document.close(); } catch(Exception e) { e.printStackTrace(); } } }
