GetAnnotationFlipState Method (AnnotationManager)
In This Topic
Gets both the horizontal and the vertical flip states of a required GdPicture/XMP annotation object specified by its index related to the selected page of the document currently handled by this AnnotationManager object.
Be aware that this method only handles GdPicture/XMP annotations. Likewise, annotations are always treated relative to the selected page.
Syntax
'Declaration
Public Function GetAnnotationFlipState( _
ByVal As Integer, _
ByRef As Boolean, _
ByRef As Boolean _
) As GdPictureStatus
public GdPictureStatus GetAnnotationFlipState(
int ,
ref bool ,
ref bool
)
public function GetAnnotationFlipState(
: Integer;
var : Boolean;
var : Boolean
): GdPictureStatus;
public function GetAnnotationFlipState(
: int,
: boolean,
: boolean
) : GdPictureStatus;
public: GdPictureStatus GetAnnotationFlipState(
int ,
ref bool ,
ref bool
)
public:
GdPictureStatus GetAnnotationFlipState(
int ,
bool% ,
bool%
)
Parameters
- AnnotationIdx
- The 0-based index of the required annotation within the selected page of the handled document. It must be a value from 0 to GetAnnotationCount-1.
- FlipX
- Output parameter. Returns true, if the specified annotation is flipped horizontally; otherwise it returns false.
- FlipY
- Output parameter. Returns true, if the specified annotation is flipped vertically; otherwise it returns false.
Return Value
A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.
We strongly recommend always checking this status first.
Example
How to flip all line arrow annotations to their opposite flip states in the loaded file.
Using annotationManager As AnnotationManager = New AnnotationManager()
If annotationManager.InitFromFile("arrow.jpeg") = GdPictureStatus.OK Then
For p As Integer = 1 To annotationManager.PageCount
If annotationManager.SelectPage(p) = GdPictureStatus.OK Then
Dim annotCount As Integer = annotationManager.GetAnnotationCount()
If annotationManager.GetStat() = GdPictureStatus.OK Then
For a As Integer = 0 To annotCount - 1
Dim type As GdPicture14.Annotations.Annotation.GdPictureAnnotationType = annotationManager.GetAnnotationType(a)
If annotationManager.GetStat() = GdPictureStatus.OK Then
If type = GdPicture14.Annotations.Annotation.GdPictureAnnotationType.AnnotationTypeLineArrow Then
Dim flipx As Boolean = False, flipy As Boolean = False
If annotationManager.GetAnnotationFlipState(a, flipx, flipy) = GdPictureStatus.OK Then
annotationManager.SetAnnotationFlipState(a, Not flipx, Not flipy)
End If
End If
End If
Next
If annotationManager.GetStat() = GdPictureStatus.OK Then annotationManager.SaveAnnotationsToPage()
If annotationManager.GetStat() <> GdPictureStatus.OK Then Exit For
Else
Exit For
End If
Else
Exit For
End If
Next
If annotationManager.GetStat() = GdPictureStatus.OK Then
If annotationManager.SaveDocumentToJPEG("arrow_flipped.jpeg", 75) = GdPictureStatus.OK Then
MessageBox.Show("Done!", "AnnotationManager.GetAnnotationFlipState")
Else
MessageBox.Show("The file can't be saved. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetAnnotationFlipState")
End If
Else
MessageBox.Show("Error! Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetAnnotationFlipState")
End If
annotationManager.Close()
Else
MessageBox.Show("The AnnotationManager can't be properly initialized. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetAnnotationFlipState")
End If
End Using
using (AnnotationManager annotationManager = new AnnotationManager())
{
if (annotationManager.InitFromFile("arrow.jpeg") == GdPictureStatus.OK)
{
for (int p = 1; p <= annotationManager.PageCount; p++)
{
if (annotationManager.SelectPage(p) == GdPictureStatus.OK)
{
int annotCount = annotationManager.GetAnnotationCount();
if (annotationManager.GetStat() == GdPictureStatus.OK)
{
for (int a = 0; a < annotCount; a++)
{
GdPicture14.Annotations.Annotation.GdPictureAnnotationType type = annotationManager.GetAnnotationType(a);
if (annotationManager.GetStat() == GdPictureStatus.OK)
{
if (type == GdPicture14.Annotations.Annotation.GdPictureAnnotationType.AnnotationTypeLineArrow)
{
bool flipx = false, flipy = false;
if (annotationManager.GetAnnotationFlipState(a, ref flipx, ref flipy) == GdPictureStatus.OK)
annotationManager.SetAnnotationFlipState(a, !flipx, !flipy);
}
}
}
if (annotationManager.GetStat() == GdPictureStatus.OK)
annotationManager.SaveAnnotationsToPage();
if (annotationManager.GetStat() != GdPictureStatus.OK) break;
}
else break;
}
else break;
}
if (annotationManager.GetStat() == GdPictureStatus.OK)
{
if (annotationManager.SaveDocumentToJPEG("arrow_dest.jpeg", 75) == GdPictureStatus.OK)
MessageBox.Show("Done!", "AnnotationManager.GetAnnotationFlipState");
else
MessageBox.Show("The file can't be saved. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetAnnotationFlipState");
}
else
MessageBox.Show("Error! Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetAnnotationFlipState");
annotationManager.Close();
}
else
MessageBox.Show("The AnnotationManager can't be properly initialized. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetAnnotationFlipState");
}
Example
How to flip all line arrow annotations to their opposite flip states in the loaded file.
Using annotationManager As AnnotationManager = New AnnotationManager()
If annotationManager.InitFromFile("arrow.jpeg") = GdPictureStatus.OK Then
For p As Integer = 1 To annotationManager.PageCount
If annotationManager.SelectPage(p) = GdPictureStatus.OK Then
Dim annotCount As Integer = annotationManager.GetAnnotationCount()
If annotationManager.GetStat() = GdPictureStatus.OK Then
For a As Integer = 0 To annotCount - 1
Dim type As GdPicture14.Annotations.Annotation.GdPictureAnnotationType = annotationManager.GetAnnotationType(a)
If annotationManager.GetStat() = GdPictureStatus.OK Then
If type = GdPicture14.Annotations.Annotation.GdPictureAnnotationType.AnnotationTypeLineArrow Then
Dim flipx As Boolean = False, flipy As Boolean = False
If annotationManager.GetAnnotationFlipState(a, flipx, flipy) = GdPictureStatus.OK Then
annotationManager.SetAnnotationFlipState(a, Not flipx, Not flipy)
End If
End If
End If
Next
If annotationManager.GetStat() = GdPictureStatus.OK Then annotationManager.SaveAnnotationsToPage()
If annotationManager.GetStat() <> GdPictureStatus.OK Then Exit For
Else
Exit For
End If
Else
Exit For
End If
Next
If annotationManager.GetStat() = GdPictureStatus.OK Then
If annotationManager.SaveDocumentToJPEG("arrow_flipped.jpeg", 75) = GdPictureStatus.OK Then
MessageBox.Show("Done!", "AnnotationManager.GetAnnotationFlipState")
Else
MessageBox.Show("The file can't be saved. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetAnnotationFlipState")
End If
Else
MessageBox.Show("Error! Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetAnnotationFlipState")
End If
annotationManager.Close()
Else
MessageBox.Show("The AnnotationManager can't be properly initialized. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetAnnotationFlipState")
End If
End Using
using (AnnotationManager annotationManager = new AnnotationManager())
{
if (annotationManager.InitFromFile("arrow.jpeg") == GdPictureStatus.OK)
{
for (int p = 1; p <= annotationManager.PageCount; p++)
{
if (annotationManager.SelectPage(p) == GdPictureStatus.OK)
{
int annotCount = annotationManager.GetAnnotationCount();
if (annotationManager.GetStat() == GdPictureStatus.OK)
{
for (int a = 0; a < annotCount; a++)
{
GdPicture14.Annotations.Annotation.GdPictureAnnotationType type = annotationManager.GetAnnotationType(a);
if (annotationManager.GetStat() == GdPictureStatus.OK)
{
if (type == GdPicture14.Annotations.Annotation.GdPictureAnnotationType.AnnotationTypeLineArrow)
{
bool flipx = false, flipy = false;
if (annotationManager.GetAnnotationFlipState(a, ref flipx, ref flipy) == GdPictureStatus.OK)
annotationManager.SetAnnotationFlipState(a, !flipx, !flipy);
}
}
}
if (annotationManager.GetStat() == GdPictureStatus.OK)
annotationManager.SaveAnnotationsToPage();
if (annotationManager.GetStat() != GdPictureStatus.OK) break;
}
else break;
}
else break;
}
if (annotationManager.GetStat() == GdPictureStatus.OK)
{
if (annotationManager.SaveDocumentToJPEG("arrow_dest.jpeg", 75) == GdPictureStatus.OK)
MessageBox.Show("Done!", "AnnotationManager.GetAnnotationFlipState");
else
MessageBox.Show("The file can't be saved. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetAnnotationFlipState");
}
else
MessageBox.Show("Error! Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetAnnotationFlipState");
annotationManager.Close();
}
else
MessageBox.Show("The AnnotationManager can't be properly initialized. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.GetAnnotationFlipState");
}
See Also