I can't see how the text can be behind the template. Are you using Acrobat as the viewer? Maybe you should post the pdf.
> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of Stefan Burkard > Sent: Monday, December 13, 2004 12:21 PM > To: [EMAIL PROTECTED] > Subject: [iText-questions] Re: insert text on top layer? > > here we go: > > // first of all, i get the first page of an original pdf > PdfTemplate page1 = writer.getImportedPage(reader, 1); > > // here begins a procedure to copy the cropbox of the original pdf > // to the new pdf. additionally, i clip the new pdf that way, that > // only the size and area of this cropbox is visible (because > // the cropbox doesn't destroy information) > cb.saveState(); > // draw a rectangle with the dimension of the cropbox of the > // original-pdf > // the position is the top-left corner of the new pdf > cb.rectangle(0, cfg.getPageHeight()-crop.height(), crop.width(), > cfg.getPageHeight()); > // use this rectangle as clipping path > cb.clip(); > cb.newPath(); > // place the original pdf in the document that way, > // that the top-left corner of the cropbox > // is at the top-left corner of the new document > // this way it fits into the clipping path of the new document > cb.addTemplate(page1, -crop.left(), cfg.getPageHeight()-crop.top()); > cb.restoreState(); > > // here begins the procedure to cover two areas of the > // original pdf-content (in the new pdf) > cb.setColorFill(Color.WHITE); > // first area to cover the original pdf > cb.rectangle(cfg.getHideAreaLeftX(), cfg.getHideAreaLeftY(), > cfg.getHideAreaLeftW(), cfg.getHideAreaLeftH()); > // second area to cover orginial pdf > cb.rectangle(cfg.getHideAreaRightX(), cfg.getHideAreaRightY(), > cfg.getHideAreaRightW(), cfg.getHideAreaRightH()); > cb.fill(); > > // begin the insertion of dynamic text > // this text appears in the back of the pdf-template-content > cb.beginText(); > // set the font and size > cb.setFontAndSize(font, fontSize); > // set the coordinates > cb.setTextMatrix(positionX, positionY); > // insert the text > cb.showText(textToInsert); > // begin the insertion of dynamic text > cb.endText(); > > > Paulo Soares wrote: > > Post a small example so that we can reproduce the problem. > > > > > >>-----Original Message----- > >>From: [EMAIL PROTECTED] > >>[mailto:[EMAIL PROTECTED] On > >>Behalf Of Stefan Burkard > >>Sent: Monday, December 13, 2004 10:58 AM > >>To: [EMAIL PROTECTED] > >>Subject: [iText-questions] insert text on top layer? > >> > >>hi all > >> > >>i'm inserting a template and white rectangles on a pdf-page - > >>all with > >>the methods of PdfContentByte. > >>When i finally insert any text with cb.beginText() ... > >>cb.endText() it > >>appears on the "lowest" layer. therefore it's even behind the > >>objects of > >>the pdf-template. > >> > >>how can i insert the text on top of any other objects? i > thought that > >>the order of insertion is relevant, but i insert the text > as the last > >>thing... > >> > >>thanks and greetings > >>stefan > >> > >> > >> > >>------------------------------------------------------- > >>SF email is sponsored by - The IT Product Guide > >>Read honest & candid reviews on hundreds of IT Products from > >>real users. > >>Discover which products truly live up to the hype. Start > reading now. > >>http://productguide.itmanagersjournal.com/ > >>_______________________________________________ > >>iText-questions mailing list > >>[EMAIL PROTECTED] > >>https://lists.sourceforge.net/lists/listinfo/itext-questions > >> > > > > > > > > ------------------------------------------------------- > > SF email is sponsored by - The IT Product Guide > > Read honest & candid reviews on hundreds of IT Products > from real users. > > Discover which products truly live up to the hype. Start > reading now. > > http://productguide.itmanagersjournal.com/ > > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from > real users. > Discover which products truly live up to the hype. Start reading now. > http://productguide.itmanagersjournal.com/ > _______________________________________________ > iText-questions mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/itext-questions > ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ _______________________________________________ iText-questions mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions
