SetAnnotationFlipState Method (AnnotationManager)
In This Topic
Sets 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 SetAnnotationFlipState( _
ByVal As Integer, _
ByVal As Boolean, _
ByVal As Boolean _
) As GdPictureStatus
public GdPictureStatus SetAnnotationFlipState(
int ,
bool ,
bool
)
public function SetAnnotationFlipState(
: Integer;
: Boolean;
: Boolean
): GdPictureStatus;
public function SetAnnotationFlipState(
: int,
: boolean,
: boolean
) : GdPictureStatus;
public: GdPictureStatus SetAnnotationFlipState(
int ,
bool ,
bool
)
public:
GdPictureStatus SetAnnotationFlipState(
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
- Set this parameter to true if you want to flip the specified annotation horizontally; otherwise set it to false.
- FlipY
- Set this parameter to true if you want to flip the specified annotation vertically; otherwise set it to 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.SetAnnotationFlipState")
Else
MessageBox.Show("The file can't be saved. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SetAnnotationFlipState")
End If
Else
MessageBox.Show("Error! Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SetAnnotationFlipState")
End If
annotationManager.Close()
Else
MessageBox.Show("The AnnotationManager can't be properly initialized. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SetAnnotationFlipState")
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.SetAnnotationFlipState");
else
MessageBox.Show("The file can't be saved. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SetAnnotationFlipState");
}
else
MessageBox.Show("Error! Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SetAnnotationFlipState");
annotationManager.Close();
}
else
MessageBox.Show("The AnnotationManager can't be properly initialized. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SetAnnotationFlipState");
}
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.SetAnnotationFlipState")
Else
MessageBox.Show("The file can't be saved. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SetAnnotationFlipState")
End If
Else
MessageBox.Show("Error! Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SetAnnotationFlipState")
End If
annotationManager.Close()
Else
MessageBox.Show("The AnnotationManager can't be properly initialized. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SetAnnotationFlipState")
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.SetAnnotationFlipState");
else
MessageBox.Show("The file can't be saved. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SetAnnotationFlipState");
}
else
MessageBox.Show("Error! Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SetAnnotationFlipState");
annotationManager.Close();
}
else
MessageBox.Show("The AnnotationManager can't be properly initialized. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SetAnnotationFlipState");
}
See Also