At first, I did not realize that the writer was available through the cb
member.

Now I have the solution I was looking for using a PdfAnnotation.  Thanks for
the help!


   // This is the straightforward, original way that iText
   // adds hyperlinks to text.  The problem is that Acrobat Reader
   // shows the full ugly URL in an unsuppressable tooltip.

       PdfAction action = new PdfAction(url.toString());
       cb.setAction(action, (float)leftX, (float)leftY,
(float)(leftX+width), (float)(leftY+height));


   // This JavaScript action acts the same as the code above,
   // but does not show any tooltip in Acrobat Reader.

       final PdfWriter writer = cb.getPdfWriter();

       final PdfAction action = PdfAction.javaScript(
             "if(app.viewerVersion<7) {" +
             "  this.openURL(\""+ url.toString() + "\", true);" +
             "} else {" +
             "  app.launchURL(\""+ url.toString() + "\", true);" +
             "}",
             writer );

       final PdfAnnotation link = new PdfAnnotation(
              writer,
              (float)leftX, (float)leftY, (float)(leftX+width),
(float)(leftY+height),
              action );
       link.setHighlighting( PdfAnnotation.HIGHLIGHT_NONE );

       writer.addAnnotation( link );

-- 
View this message in context: 
http://itext-general.2136553.n4.nabble.com/Custom-hyperlink-hover-text-tp3056253p3059760.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to