By Date: <-- -->
By Thread: <-- -->

How to add Anchor to PdfContentByte



Hello,

Is there a way to add an Anchor to the content byte? I'm using the
onEndPage event to add a footer to my pages... the footer has a link
that I wanna make clickable, but haven't found anything in the api
docs or the samples that shows how to do this... In the following
method, I'd like to replace "the_url" with an Anchor (or similar) so
that it's clickable... the method is called by onEndPage.

private void addFooter (PdfWriter writer, Document document) {

       int page = document.getPageNumber ();
       float x = footer.left () + (footer.width () / 2f);
       float y = footer.bottom ();

       PdfContentByte cb = writer.getDirectContent ();

       // Add line to footer...
       cb.moveTo (footer.left (), footer.top ());
       cb.lineTo (footer.right (), footer.top ());
       cb.stroke ();

       cb.beginText ();
       cb.setFontAndSize (basefont, 10);
       cb.showTextAligned (PdfContentByte.ALIGN_CENTER, "" + page, x, y, 0);
       cb.showTextAligned (PdfContentByte.ALIGN_RIGHT, the_url,
footer.right (), y, 0);
       cb.showTextAligned (PdfContentByte.ALIGN_LEFT, copyright,
footer.left (), y, 0);
       cb.endText ();
   }

thanks much...


------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642 _______________________________________________ iText-questions mailing list iText-questions (at) lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions