Just tried that. Doesn't do the thing I am after..

 

Surely setting the Color to null just makes it Black

 

 

john renfrew 

Right Way Up 
Office  +44 1675 475341 
Fax      +44 1675 475342 
Mobile +44 7767 443992

 

From: Mark Storer [mailto:[email protected]] 
Sent: 05 November 2009 18:56
To: [email protected]; Post all your questions about iText here
Subject: RE: Spam: [iText-questions] Invisible links

 

I think what you want is to set the border & fill color to null rather than
setting the entire annotation "hidden".  Hidden annotations (& fields)
should not interact with the cursor at all.  Sounds more like a mac-acrobat
bug than one on the PC.

 

link.setMKBorderColor( null );

link.setMKBackgroundColor( null );

 

--Mark Storer 
  Senior Software Engineer 
  Cardiff.com

#include <disclaimer> 
typedef std::Disclaimer<Cardiff> DisCard; 

-----Original Message-----
From: John Renfrew [mailto:[email protected]]
Sent: Thursday, November 05, 2009 7:50 AM
To: [email protected]
Subject: Spam: [iText-questions] Invisible links

Successfully got my stamper to put several lines of text in different
colours at the bottom of a document each with a link to something different.

 

Had been testing it hard on a Mac, when I came to add it to the client
solution which runs on PC the outputted PDF file had the link there, but the
cursor insisted on being a text i-beam which meant that it could not be
clicked. As soon as it was turned into a visible type (and therefore ugly)
it became a well behaved link again.

 

Is this normal behaviour??? Or did I miss a trick???

 

fm_Font, fm_fileIn and fm_fileOut are passed variables.

 

 

//John 02_11_09

import com.lowagie.text.*;

import com.lowagie.text.pdf.*;

import org.apache.commons.codec.binary.*;

 

 

 

try {

                                                PdfReader reader;

                                                PdfStamper stamper;

                                                reader = new PdfReader
(fm_FileIn);

                                                stamper = new
PdfStamper(reader, new FileOutputStream( fm_FileOut));

 
stamper.setViewerPreferences(PdfWriter.HideWindowUI | PdfWriter.HideToolbar
| PdfWriter.PageLayoutOneColumn );

                                                PdfWriter writer =
stamper.getWriter();

                                                PdfAnnotation link =
PdfAnnotation.createLink(writer, new Rectangle(50,70,108,88),
PdfAnnotation.HIGHLIGHT_INVERT, new
PdfAction("mailto:[email protected]?subject=subject";));

 
link.setFlags(PdfAnnotation.FLAGS_HIDDEN);

                                                HashMap info =
reader.getInfo();

                                                info.put("Subject", "
Welcome pack");

                                                info.put("Author", "Admin");

                                                info.put("Title", "M21");

                                                info.put("Author", "Tim");

                                                info.put("Creator", "PDF
from iText and Filemaker");

                                                stamper.setMoreInfo(info);

                                                BaseFont bf;

                                                bf =
BaseFont.createFont(fm_Font, "Cp1252", BaseFont.EMBEDDED);

                                                PdfContentByte cb;

                                                cb =
stamper.getOverContent(1);

                                                cb.beginText();

                                                cb.setFontAndSize(bf, 13);

                                                cb.setTextMatrix(51, 75);

                                                cb.setRGBColorFill(128, 185,
23);

                                                cb.showText("Click HERE to
send an eMail");

                                                cb.endText();

                                                stamper.addAnnotation(link,
1);

                                                stamper.close();

                                } catch (IOException e) {

                                                e.printStackTrace();

                                } catch (DocumentException e) {

                                                e.printStackTrace();

                                }

 

 

 

 

 

 

john renfrew 

Right Way Up 
Office  +44 1675 475341 
Fax      +44 1675 475342 
Mobile +44 7767 443992

 

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
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