This is my onEndPage() method......But its still not displaying.....
public void onEndPage(PdfWriter writer, Document document) {
PdfContentByte cb = writer.getDirectContent();
PdfContentByte rb = writer.getDirectContent();
rb.saveState();
cb.saveState();
table.setTotalWidth(document.right() - document.left());
String text0="Joint Secretary to CM";
String text1="Chief Minister's Office,Hyd.";
String text2="Hon'ble Chief Minister has approved";
String text3="the above cases under C.M.R.F.";
float textSize = helv.getWidthPoint(text0, 9);
rb.rectangle(620,20, 180, 80);
rb.beginText();
rb.setFontAndSize(helv, 9);
rb.setLineWidth(1);
rb.setColorStroke(Color.blue);
rb.stroke();
rb.showTextAligned(PdfContentByte.ALIGN_LEFT,text0,691,34,0);
rb.showTextAligned(PdfContentByte.ALIGN_LEFT,text1,691,24,0);
rb.showTextAligned(PdfContentByte.ALIGN_LEFT,text2,650,90,0);
rb.showTextAligned(PdfContentByte.ALIGN_LEFT,text3,623,80,0);
rb.endText();
String text = "Page " + writer.getPageNumber() + " of ";
textSize = helv.getWidthPoint(text, 9);
float textBase = document.bottom() - 20;
float textBase = document.bottom() - 20;
cb.beginText();
cb.setFontAndSize(helv, 9);
if ((writer.getPageNumber() & 1) == 1) {
cb.setTextMatrix(document.left(), textBase);
cb.showText(text);
cb.endText();
cb.addTemplate(tpl, document.left() +
textSize, textBase);
}
else {
float adjust = helv.getWidthPoint("0", 9);
cb.setTextMatrix(document.left(), textBase);
cb.showText(text);
cb.endText();
cb.addTemplate(tpl, document.left() + textSize, textBase);
}
cb.saveState();
cb.restoreState();
}
On Mon, 28 Feb 2005 11:41:17 -0000, Paulo Soares <[EMAIL PROTECTED]> wrote:
> Put the rectangle before the beginText().
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On
> > Behalf Of ravi shankar
> > Sent: Monday, February 28, 2005 11:32 AM
> > To: [email protected]
> > Subject: Fwd: [iText-questions] Plz help for creating a rectangle
> >
> > Hi
> > I have a got a rectangle with text in it like this
> >
> > String text="Joint Secretary to CM";
> > String text1="Chief Minister's Office,Hyd.";
> > String text2="Hon'ble Chief Minister
> > has approved";
> > String text3="the above cases under C.M.R.F.";
> > PdfContentByte rb = writer.getDirectContent();
> > helv = BaseFont.createFont("Helvetica",
> > BaseFont.WINANSI, false);
> > float textSize = helv.getWidthPoint(text, 8);
> > rb.beginText();
> > rb.setFontAndSize(helv, 8);
> > rb.setLineWidth(1);
> > rb.setColorStroke(Color.blue);
> > rb.rectangle(630,5, 180, 80);
> > rb.stroke();
> >
> > rb.showTextAligned(PdfContentByte.ALIGN_LEFT,text,701,19,0);
> >
> > rb.showTextAligned(PdfContentByte.ALIGN_LEFT,text1,701,9,0);
> >
> > rb.showTextAligned(PdfContentByte.ALIGN_LEFT,text2,660,75,0);
> >
> > rb.showTextAligned(PdfContentByte.ALIGN_LEFT,text3,633,65,0);
> > rb.endText();
> >
> > I have got some text in the rectangle which I am printing .....This is
> > actaully a stamp which I am trying to print.....I am putting this in
> > onEndPage() but this is not getting printed.....I have the logic of
> > Page X of Y running .....I am declaring a new PdfContentByte and
> > trying to print..but it is not getting printed at all...I am unable to
> > debug since no error is shown....If I print the above code in a single
> > page ....then i am getting an error 'illegal operation 're' inside a
> > text object'..... Plz help me.
> > Regards
> > Ravi Shankar
> >
> > On Fri, 18 Feb 2005 10:00:31 -0000, Paulo Soares
> > <[EMAIL PROTECTED]> wrote:
> > > PdfContentByte cb = ...;
> > > cb.setLineWidth(2);
> > > cb.setColorStroke(Color.red);
> > > cb.rectangle(10, 10, 100, 100);
> > > cb.stroke();
> > >
> > > > -----Original Message-----
> > > > From: [EMAIL PROTECTED]
> > > > [mailto:[EMAIL PROTECTED] On
> > > > Behalf Of ravi shankar
> > > > Sent: Friday, February 18, 2005 9:36 AM
> > > > To: [email protected]
> > > > Subject: [iText-questions] Plz help for creating a rectangle
> > > >
> > > > Hi all this is my second message....I have been trying this but
> > > > couldnt succeed.....
> > > > A box like this has to appear on every page on a report
> > of table data
> > > > .....on the right side corner at the bottom of the
> > page....I tried the
> > > > footer but wasnt satisfied and also was not in my control .....can
> > > > someone suggest a better way for this.
> > > > --------------------------------------------------
> > > > | The following are approved |
> > > > | |
> > > > | |
> > > > | signed by Auth.|
> > > > |-------------------------------------------------
> > > >
> > > > Hi all. I have a report which needs to have a small
> > rectangle at the
> > > > end of every page with some formatted text in it...I could get the
> > > > page x of y functionality in every page but couldnt get
> > the rectangle
> > > > properly ....Please help me in this regard
> > > > Bye
> > > > Ravi Shankar
> > > >
> > > >
> > > > -------------------------------------------------------
> > > > 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://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> > > > _______________________________________________
> > > > 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://ads.osdn.com/?ad_ide95&alloc_id396&opclick
> > > _______________________________________________
> > > 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://ads.osdn.com/?ad_ide95&alloc_id396&op=ick
> > _______________________________________________
> > 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://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions