well...
Here go the solution...Is working fine!

public static void test(String name)throws Exception
    {

        try{
        PdfReader reader = new PdfReader("c://tempPDF.pdf");
        Rectangle psize = reader.getPageSizeWithRotation(1);

        Document document = new Document(psize);

        PdfWriter writer = PdfWriter.getInstance(document,new
FileOutputStream("c://certificate.pdf"));
        BaseFont baseFont = BaseFont.createFont(BaseFont.HELVETICA,
BaseFont.WINANSI, BaseFont.NOT_EMBEDDED);
        document.open();

        PdfContentByte cb = writer.getDirectContent();
        PdfImportedPage page;
        int rotation;
        document.setPageSize(reader.getPageSizeWithRotation(1));
        document.newPage();
        page = writer.getImportedPage(reader, 1);
        rotation = reader.getPageRotation(1);

        //landscape mode
        if (rotation == 90 || rotation == 270) {
          cb.addTemplate(page, 0, -1f, 1f, 0, 0,
          reader.getPageSizeWithRotation(1).height());
        }

        //portrait mode
        else {
          cb.addTemplate(page, 1f, 0, 0, 1f, 0, 0);
        }

        cb.beginText();
        cb.setFontAndSize(baseFont, 30);

        //------------------------------------------------------------------
        // Writing the name
        //------------------------------------------------------------------
        cb.setTextMatrix(150, 369);
        cb.showText(name);
        cb.endText();

        document.close();

           writer.flush();
        writer.close();
        }
        catch(Exception x){
            System.out.println(x.toString());
        }

    }

Is different than your solution, but is working...I hope that code can help
other members of this group

Regards!

Carlos Heitmann
IBM Brazil

2010/8/19 Carlos Heitmann <[email protected]>

> Wrong way my friend!
> When I post a question, I assumed that I will receive answers to help...of
> course I will learn with that...If I had time to read a book, then I would
> not have joined this group...
>
> Anyway, Thanx for help.
>
> Regards
>
> Carlos Heitmann
> IBM Brazil
>
> 2010/8/19 1T3XT info <[email protected]>
>
> Carlos Heitmann wrote:
>> > How?
>>
>> Create a PdfReader object, use it in a PdfStamper object.
>> Get a PdfContentByte from the PdfStamper for a specific page.
>> Stamp content on that page.
>>
>> > and Where?
>>
>> It's all documented in the 2nd edition of "iText in Action".
>>
>> > I need an example or something more clear...
>>
>> Plenty of examples in the book:
>> http://itextpdf.com/book/
>>
>> > Anyway thanx for help...was fast!
>>
>> If you post a question to the list, we assume that you want to learn.
>> Learning is done by reading the book ;-)
>>
>>
>> ------------------------------------------------------------------------------
>> This SF.net email is sponsored by
>>
>> Make an app they can't live without
>> Enter the BlackBerry Developer Challenge
>> http://p.sf.net/sfu/RIM-dev2dev
>> _______________________________________________
>> iText-questions mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/itext-questions
>>
>> Buy the iText book: http://www.itextpdf.com/book/
>> 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/
>>
>
>
------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.itextpdf.com/book/
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