Hi,

I want to add header  to an existing pdf. I am using the following code,
but the text is always added at bottom of each page not at the top.

int n= reader.getNumberOfPages();
         stamp = new PdfStamper
(reader, new FileOutputStream(desFile));
         for(int i=1; i<=n; i++){

      PdfContentByte under =
stamp.getUnderContent(i);
      PdfContentByte over =
stamp.getOverContent(i);



    BaseFont bf =

   BaseFont.createFont(

   BaseFont.TIMES_BOLD,

   BaseFont.WINANSI,

   BaseFont.NOT_EMBEDDED);


           PdfTemplate tp =
over.createTemplate(100, 100);

      over.addTemplate(tp, 80, 700);
            over.beginText();
   over.setFontAndSize(bf, 14);
   over.setTextMatrix(100, 100);
   over.showText("Page "+i+"/"+n);
   over.endText();

   PdfImportedPage page = stamp.getImportedPage
(reader, i);


      }

----------------------------------------------------------
Le pr�sent message, ainsi que les pi�ces ou annexes qui s'y trouvent
�ventuellement jointes, s'adressent exclusivement � celles des personnes
qu'ils d�signent comme destinataires. Constituant de ce fait une
correspondance priv�e � caract�re confidentiel, leur contenu est prot�g�
par le secret des correspondances �mises, transmises ou re�ues par la voie
des t�l�communications. Si ce message �lectronique vous est parvenu
fortuitement, veuillez avoir l'obligeance de le d�truire, puis d'en aviser
l'exp�diteur dans les meilleurs d�lais.

The Information in this e-mail belongs to Sanofi-Synthelabo, is intended
for the use of the individual or entity to which it is addressed, and may
contain information that is privileged, confidential, or exempt from
disclosure under applicable law. If you are not the intended recipient, you
are hereby notified that any disclosure, copying, distribution, or use of,
or reliance on, the contents of this e-mail is prohibited.  If you have
received this e-mail in error, please notify us immediately by replying
back to the sending e-mail address, and delete this e-mail message from
your computer.
----------------------------------------------------------



-------------------------------------------------------
This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to