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?
Thanks for your time!
From: Stuart Jansen <[EMAIL PROTECTED]>
Reply-To: Post all your questions about iText here
<itext-questions@lists.sourceforge.net>
To: Post all your questions about iText here
<itext-questions@lists.sourceforge.net>
Subject: Re: [iText-questions] Centering PdfTemplate on new page...
Date: Fri, 09 Mar 2007 09:06:04 -0700
On Fri, 2007-03-09 at 10:58 -0500, Rick DeFazio wrote:
> Bruno, your suggestion of wrapping a pdfTemplate in an Image to center
it on
> the new page... how would that work? I appreciate your help! BTW does
this
> seem like a good practice as I may be doing this to hundreds of legal
> documents...
>
>
> PdfContentByte cb = writer.getDirectContent();
> PdfImportedPage page = writer.getImportedPage(reader, 1);
> Image img = Image.getInstance();
>
> cb.addTemplate(img);
PdfContentByte is for manually placing stuff. It's a pretty low level
component.
You need to either center the template yourself, or put the image in a
container smart enough to center the image.
PdfDocument document = ...
document.add(img);
or
ColumnText ct = ...
ct.addElement(img);
Of these, if I understand your use case correctly, ColumnText will
probably be the better solution.
--
Stuart Jansen <[EMAIL PROTECTED]>
Guru Labs, L.C.
<< signature.asc >>
-------------------------------------------------------------------------
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/
_________________________________________________________________
Dont waste time standing in linetry shopping online. Visit Sympatico / MSN
Shopping today! http://shopping.sympatico.msn.ca
-------------------------------------------------------------------------
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/