Hi Mark,
This is how I'm creating the RTF document
Document document = new Document();
RtfWriter2 writer2 = RtfWriter2.getInstance(document, new
FileOutputStream(rtfFile));
document.open();
-
-
//add various Elements to the document
document.add();
-
-
//create a hyperlink for one of the elements, when you click on this element
it goes to a different element in the same doc.
Anchor anchor = new Anchor("Element2");
//this works if the below string is replaced with an external URL
anchor.setReference("_Recording_List");
-
-
document.close();
Rtf format generated by Word:
Hyperlink -
{\field{\*\fldinst HYPERLINK \\l "_Recording_List" }{\fldrslt
\pard\f0\fs20\cf0 Element2}}
When you click on the Element2 it goes to the destination, for which the
format is as follows -
{\*\bkmkstart _Recording_List}{\*\bkmkend _Recording_List}Element5
I didn't quite understand if RtfAnchor is being used in hyperlink
generation. I also tried RtfWriter which seems to be using Anchor.
Thanks again for your help
Divya
From: Mark Hall <[EMAIL PROTECTED]>
To: [email protected]
CC: "Divya Nagireddy" <[EMAIL PROTECTED]>
Subject: Re: [iText-questions] Hyperlink to a different location in the RTF
doc
Date: Fri, 6 Jan 2006 15:02:39 +0100
On Thursday 05 January 2006 22:15, Divya Nagireddy wrote:
> Any hint on how to implement it?
You need to read the RTF 1.6 specification
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnrtfspec/html/rtfspec.asp)
and also look at what Word generates when you have a document with internal
links. This is a bit of a pain since Word doesn't always fully follow the
specification.
Then you have to modify the code that writes Anchor objects to also handle
internal links (com.lowagie.text.rtf.field.RtfAnchor).
Depending on how internal anchors are implemented in RTF (I haven't looked
into it) you might have to parse the generated RTF document a second time
to
correct the references. But since I haven't looked into this, I can't say
whether this is really necessary.
I think these three steps should cover most of the process. If you've got
further questions on the internal workings of the RTF generation, just ask.
Greetings,
Mark
--
You have the power to influence all with whom you come in contact.
My GPG public key is available at:
http://www.edu.uni-klu.ac.at/~mhall/data/security/MarkHall.asc
<< attach3 >>
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions