On Fri, 2007-03-09 at 11:23 -0500, Rick DeFazio wrote: > Here are my requirements: > > 1. ability to add a company logo to an existing document on a mass scale. > > So my steps are: > > 1. use PdfContentByte to copy the document > 2. then add the logo to the copied document ie. cb.addImage(img); > 3. and finally I need to CENTER this imported new page onto a new document. > > The only thing not working is automatically centering it. I am using a > method which requires certain xy values. ie. cb.addTemplate(page, 1, 20); > which I don't want... > > > Is there a way to automatically do this?
Not that I'm aware of. So what's wrong with doing it by hand? Document document = new Document(PageSize.LETTER, 0, 0, 0, 0); PdfWriter.getInstance(document, new FileOutputStream( "pagecenteredimage.pdf")); document.open(); Image png = Image.getInstance("lib/images/hitchcock.png"); float imageWidth = png.width(); float imageHeight = png.height(); float pageHeight = document.top() - document.bottom(); float pageWidth = document.right() - document.left(); png.setAbsolutePosition(pageWidth/2 - imageWidth/2, pageHeight/2 - imageHeight/2); document.add(png); document.close(); -- Stuart Jansen <[EMAIL PROTECTED]> Guru Labs, L.C.
signature.asc
Description: This is a digitally signed message part
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/