AddLinkAnnot Method (AnnotationManager)
In This Topic
Adds a new GdPicture/XMP link annotation on the selected page of the document currently handled by this AnnotationManager object according to the parameters you have specified. A link annotation depicts the defined text, that points to a link destination, that means to a web site or to a page in the current document.
The type of the newly added annotation object is GdPictureAnnotationType.AnnotationTypeLink. You can change the annotation properties directly using the GdPicture14.Annotations.AnnotationLink class right after the successful creation of the annotation object.
Be aware that annotations are always treated relative to the currently selected page.
Syntax
'Declaration
Public Function AddLinkAnnot( _
ByVal As Single, _
ByVal As Single, _
ByVal As Single, _
ByVal As Single, _
ByVal As String, _
ByVal As String _
) As AnnotationLink
public AnnotationLink AddLinkAnnot(
float ,
float ,
float ,
float ,
string ,
string
)
public function AddLinkAnnot(
: Single;
: Single;
: Single;
: Single;
: String;
: String
): AnnotationLink;
public function AddLinkAnnot(
: float,
: float,
: float,
: float,
: String,
: String
) : AnnotationLink;
public: AnnotationLink* AddLinkAnnot(
float ,
float ,
float ,
float ,
string* ,
string*
)
public:
AnnotationLink^ AddLinkAnnot(
float ,
float ,
float ,
float ,
String^ ,
String^
)
Parameters
- Left
- The horizontal (X) coordinate of the top left point, in inches, where the annotation bounding box is to be located.
- Top
- The vertical (Y) coordinate of the top left point, in inches, where the annotation bounding box is to be located.
- Width
- The width of the annotation bounding box, in inches.
- Height
- The height of the annotation bounding box, in inches.
- Text
- The text to render, means the displayed text, of the newly added link annotation.
- Link
- The destination of the newly added link annotation, for example http://www.gdpicture.com or page:5. It corresponds to the AnnotationLink.Link property.
Return Value
A GdPicture/XMP AnnotationLink object. The newly added GdPicture/XMP link annotation.
Example
How to add a link annotation to a newly created image.
Dim status As GdPictureStatus = GdPictureStatus.OK
Using image As GdPictureImaging = New GdPictureImaging()
Dim imageID As Integer = image.CreateNewGdPictureImage(1000, 1600, CShort(32), Color.White)
status = image.GetStat()
If (status = GdPictureStatus.OK) AndAlso (imageID <> 0) Then
Using annotMgr As AnnotationManager = New AnnotationManager()
If (annotMgr.InitFromGdPictureImage(imageID) = GdPictureStatus.OK) AndAlso
(annotMgr.SelectPage(1) = GdPictureStatus.OK) Then
Dim annot As GdPicture14.Annotations.AnnotationLink = annotMgr.AddLinkAnnot(1, 1, 5, 0.5F, "ORPALIS", "www.orpalis.com")
If (annotMgr.GetStat() = GdPictureStatus.OK) AndAlso (annot IsNot Nothing) Then
annot.Author = "GdPicture"
annot.FontStyle = System.Drawing.FontStyle.Italic
annot.ForeColor = Color.CadetBlue
annot.Opacity = 0.8F
End If
annot.Dispose()
annot = annotMgr.AddLinkAnnot(1, 3, 5, 0.5F, "GdPicture", "www.gdpicture.com")
If (annotMgr.GetStat() = GdPictureStatus.OK) AndAlso (annot IsNot Nothing) Then
annot.Author = "GdPicture"
annot.ForeColor = Color.BlueViolet
annot.FontStyle = System.Drawing.FontStyle.Regular
annot.Opacity = 0.8F
End If
annot.Dispose()
If annotMgr.SaveAnnotationsToPage() = GdPictureStatus.OK Then
annotMgr.SaveDocumentToJPEG("linkannot.jpeg", 75)
End If
End If
status = annotMgr.GetStat()
annotMgr.Close()
End Using
image.ReleaseGdPictureImage(imageID)
End If
End Using
'We assume that the GdViewer1 control has been integrated into your application.
If status = GdPictureStatus.OK Then
GdViewer1.DisplayFromFile("linkannot.jpeg")
Else
MessageBox.Show("Error! Status: " + status.ToString(), "AnnotationManager.AddLinkAnnot")
End If
GdPictureStatus status = GdPictureStatus.OK;
using (GdPictureImaging image = new GdPictureImaging())
{
int imageID = image.CreateNewGdPictureImage(1000, 1600, 32, Color.White);
status = image.GetStat();
if ((status == GdPictureStatus.OK) && (imageID != 0))
{
using (AnnotationManager annotMgr = new AnnotationManager())
{
if ((annotMgr.InitFromGdPictureImage(imageID) == GdPictureStatus.OK) &&
(annotMgr.SelectPage(1) == GdPictureStatus.OK))
{
GdPicture14.Annotations.AnnotationLink annot = annotMgr.AddLinkAnnot(1, 1, 5, 0.5f, "ORPALIS", "www.orpalis.com");
if ((annotMgr.GetStat() == GdPictureStatus.OK) && (annot != null))
{
annot.Author = "GdPicture";
annot.FontStyle = System.Drawing.FontStyle.Italic;
annot.ForeColor = Color.CadetBlue;
annot.Opacity = 0.8f;
}
annot.Dispose();
annot = annotMgr.AddLinkAnnot(1, 3, 5, 0.5f, "GdPicture", "www.gdpicture.com");
if ((annotMgr.GetStat() == GdPictureStatus.OK) && (annot != null))
{
annot.Author = "GdPicture";
annot.ForeColor = Color.BlueViolet;
annot.FontStyle = System.Drawing.FontStyle.Regular;
annot.Opacity = 0.8f;
}
annot.Dispose();
if (annotMgr.SaveAnnotationsToPage() == GdPictureStatus.OK)
annotMgr.SaveDocumentToJPEG("linkannot.jpeg", 75);
}
status = annotMgr.GetStat();
annotMgr.Close();
}
image.ReleaseGdPictureImage(imageID);
}
}
//We assume that the GdViewer1 control has been integrated into your application.
if (status == GdPictureStatus.OK)
GdViewer1.DisplayFromFile("linkannot.jpeg");
else
MessageBox.Show("Error! Status: " + status.ToString(), "AnnotationManager.AddLinkAnnot");
Example
How to add a link annotation to a newly created image.
Dim status As GdPictureStatus = GdPictureStatus.OK
Using image As GdPictureImaging = New GdPictureImaging()
Dim imageID As Integer = image.CreateNewGdPictureImage(1000, 1600, CShort(32), Color.White)
status = image.GetStat()
If (status = GdPictureStatus.OK) AndAlso (imageID <> 0) Then
Using annotMgr As AnnotationManager = New AnnotationManager()
If (annotMgr.InitFromGdPictureImage(imageID) = GdPictureStatus.OK) AndAlso
(annotMgr.SelectPage(1) = GdPictureStatus.OK) Then
Dim annot As GdPicture14.Annotations.AnnotationLink = annotMgr.AddLinkAnnot(1, 1, 5, 0.5F, "ORPALIS", "www.orpalis.com")
If (annotMgr.GetStat() = GdPictureStatus.OK) AndAlso (annot IsNot Nothing) Then
annot.Author = "GdPicture"
annot.FontStyle = System.Drawing.FontStyle.Italic
annot.ForeColor = Color.CadetBlue
annot.Opacity = 0.8F
End If
annot.Dispose()
annot = annotMgr.AddLinkAnnot(1, 3, 5, 0.5F, "GdPicture", "www.gdpicture.com")
If (annotMgr.GetStat() = GdPictureStatus.OK) AndAlso (annot IsNot Nothing) Then
annot.Author = "GdPicture"
annot.ForeColor = Color.BlueViolet
annot.FontStyle = System.Drawing.FontStyle.Regular
annot.Opacity = 0.8F
End If
annot.Dispose()
If annotMgr.SaveAnnotationsToPage() = GdPictureStatus.OK Then
annotMgr.SaveDocumentToJPEG("linkannot.jpeg", 75)
End If
End If
status = annotMgr.GetStat()
annotMgr.Close()
End Using
image.ReleaseGdPictureImage(imageID)
End If
End Using
'We assume that the GdViewer1 control has been integrated into your application.
If status = GdPictureStatus.OK Then
GdViewer1.DisplayFromFile("linkannot.jpeg")
Else
MessageBox.Show("Error! Status: " + status.ToString(), "AnnotationManager.AddLinkAnnot")
End If
GdPictureStatus status = GdPictureStatus.OK;
using (GdPictureImaging image = new GdPictureImaging())
{
int imageID = image.CreateNewGdPictureImage(1000, 1600, 32, Color.White);
status = image.GetStat();
if ((status == GdPictureStatus.OK) && (imageID != 0))
{
using (AnnotationManager annotMgr = new AnnotationManager())
{
if ((annotMgr.InitFromGdPictureImage(imageID) == GdPictureStatus.OK) &&
(annotMgr.SelectPage(1) == GdPictureStatus.OK))
{
GdPicture14.Annotations.AnnotationLink annot = annotMgr.AddLinkAnnot(1, 1, 5, 0.5f, "ORPALIS", "www.orpalis.com");
if ((annotMgr.GetStat() == GdPictureStatus.OK) && (annot != null))
{
annot.Author = "GdPicture";
annot.FontStyle = System.Drawing.FontStyle.Italic;
annot.ForeColor = Color.CadetBlue;
annot.Opacity = 0.8f;
}
annot.Dispose();
annot = annotMgr.AddLinkAnnot(1, 3, 5, 0.5f, "GdPicture", "www.gdpicture.com");
if ((annotMgr.GetStat() == GdPictureStatus.OK) && (annot != null))
{
annot.Author = "GdPicture";
annot.ForeColor = Color.BlueViolet;
annot.FontStyle = System.Drawing.FontStyle.Regular;
annot.Opacity = 0.8f;
}
annot.Dispose();
if (annotMgr.SaveAnnotationsToPage() == GdPictureStatus.OK)
annotMgr.SaveDocumentToJPEG("linkannot.jpeg", 75);
}
status = annotMgr.GetStat();
annotMgr.Close();
}
image.ReleaseGdPictureImage(imageID);
}
}
//We assume that the GdViewer1 control has been integrated into your application.
if (status == GdPictureStatus.OK)
GdViewer1.DisplayFromFile("linkannot.jpeg");
else
MessageBox.Show("Error! Status: " + status.ToString(), "AnnotationManager.AddLinkAnnot");
See Also