public final class Hyperlink extends Object implements ILinkActionsCarrier
Represents a link in a Pdf document.
[Java] Pdf pdf1 = new Pdf(); Section sec1 = pdf1.getSections().add(); Text text1 = new Text(sec1); sec1.getParagraphs().add(text1); Segment segment1 = text1.getSegments().add("this is a local file link"); segment1.getHyperlink ( new Hyperlink()); segment1.getHyperlink().setLinkFile ( "c:/images/apple.jpg"); segment1.getHyperlink().setLinkType ( HyperlinkType.File); Text text2 = new Text(sec1); sec1.getParagraphs().add(text2); Segment segment2 = text2.getSegments().add("this is a web link"); segment2.setyHyperlink ( new Hyperlink()); segment2.getHyperlink().setUrl ( "http://localhost/popup.htm"); segment2.getHyperlink().setLinkType ( HyperlinkType.Web); text1 = new Text(sec1); sec1.getParagraphs().add(text1); segment1 = text1.getSegments().add("this is a local link"); segment1.getTextInfo().setIsUnderline ( true); segment1.getHyperlink().setLinkType ( HyperlinkType.Local); segment1.getHyperlink().setTargetID ( "product1"); Text text3 = new Text(sec1,"product 1 info ..."); sec1.getParagraphs().add(text3); text3.setIsFirstParagraph ( true); text3.setID ( "product1"); pdf1.save(...); [XML] <?xml version="1.0" encoding="utf-8" ?> <Pdf xmlns="Aspose.Pdf"> <Section> <Text> <Segment LinkFile="c:/Images/apple.jpg" LinkType="File"> this is a local file link </Segment> </Text> <Text> <Segment Url="http://localhost/popup.htm" LinkType="Web"> this is a web link </Segment> </Text> <Text> <Segment TargetID="product1" LinkType="Local" IsUnderline="true"> this is a local link </Segment> </Text> <Text IsFirstParagraph="true" ID="product1"> <Segment> product 1 info ... </Segment> </Text> </Section> </Pdf>
Modifier and Type | Field and Description |
---|---|
int |
_DestinationType
Gets or sets a
DestinationType that indicates the destination type. |
boolean |
IsLinkToNewWindow
Gets or sets a boolean value that indicates whether to open file in a new window.
|
String |
LinkFile
Gets or sets a string that indicates the link file name.
|
int |
LinkPageNumber
Gets or sets an int value that indicates the page number of the link page.
|
int |
LinkType
Gets or sets a
HyperlinkType object that indicates the link type. |
String |
TargetID
Gets or sets a string that indicates the link target ID.
|
String |
Url
Gets or sets a string that indicates the link url.
|
Constructor and Description |
---|
Hyperlink()
Initializes a new instance of the
Hyperlink class. |
Modifier and Type | Method and Description |
---|---|
void |
addLinkAction(LinkAction action)
Adds link action to list of action that will be executed on click on this link
|
Object |
completeClone()
Clones a new
Hyperlink object. |
int |
getCountOfLinkActions() |
LinkAction |
getLinkAction(int index) |
public int LinkType
Gets or sets a HyperlinkType
object that indicates the link type.
public String TargetID
Gets or sets a string that indicates the link target ID.
public int _DestinationType
Gets or sets a DestinationType
that indicates the destination type.
public String LinkFile
Gets or sets a string that indicates the link file name.
public int LinkPageNumber
Gets or sets an int value that indicates the page number of the link page.
public String Url
Gets or sets a string that indicates the link url.
public boolean IsLinkToNewWindow
Gets or sets a boolean value that indicates whether to open file in a new window.
public void addLinkAction(LinkAction action)
Adds link action to list of action that will be executed on click on this link
addLinkAction
in interface ILinkActionsCarrier
public int getCountOfLinkActions()
getCountOfLinkActions
in interface ILinkActionsCarrier
public LinkAction getLinkAction(int index)
getLinkAction
in interface ILinkActionsCarrier
public Object completeClone()
Clones a new Hyperlink
object.
Hyperlink
object.Copyright © 2014 Aspose. All Rights Reserved.