GdPicture.NET.14.API
GdPicture14 Namespace / AnnotationManager Class / RotateAnnotations Method
The rotation angle, in degrees, determining the clockwise rotation. This parameter can only be set to 90, 180, 270; otherwise the method will fail.
Example





In This Topic
RotateAnnotations Method (AnnotationManager)
In This Topic
Rotates clockwise by a specified angle all GdPicture/XMP annotations contained within the selected page of the document currently handled by this AnnotationManager object. The coordinate system of the currently selected page is used to determine the rotation direction.

Be aware that this method only handles GdPicture/XMP annotations. Likewise, annotations are always treated relative to the selected page.

Syntax
'Declaration
 
Public Function RotateAnnotations( _
   ByVal Angle As Integer _
) As GdPictureStatus
public GdPictureStatus RotateAnnotations( 
   int Angle
)
public function RotateAnnotations( 
    Angle: Integer
): GdPictureStatus; 
public function RotateAnnotations( 
   Angle : int
) : GdPictureStatus;
public: GdPictureStatus RotateAnnotations( 
   int Angle
) 
public:
GdPictureStatus RotateAnnotations( 
   int Angle
) 

Parameters

Angle
The rotation angle, in degrees, determining the clockwise rotation. This parameter can only be set to 90, 180, 270; otherwise the method will fail.

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.
Remarks

This method requires the Annotations component to run.

Example
How to rotate all annotations on the selected page.
Dim annotationManager As AnnotationManager = New AnnotationManager()
If (annotationManager.InitFromFile("image.jpg") = GdPictureStatus.OK) AndAlso
   (annotationManager.PageCount > 0) AndAlso (annotationManager.SelectPage(1) = GdPictureStatus.OK) Then
    If annotationManager.RotateAnnotations(90) = GdPictureStatus.OK Then
        If (annotationManager.SaveAnnotationsToPage() = GdPictureStatus.OK) AndAlso
           (annotationManager.BurnAnnotationsToPage(True) = GdPictureStatus.OK) Then
            If annotationManager.SaveDocumentToJPEG("image_rotated.jpg", 75) = GdPictureStatus.OK Then
                MessageBox.Show("Finished successfully!", "AnnotationManager.RotateAnnotations")
            Else
                MessageBox.Show("The file can't be saved. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.RotateAnnotations")
            End If
        Else
            MessageBox.Show("Annotations can't be saved or burned. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.RotateAnnotations")
        End If
    Else
        MessageBox.Show("Annotations can't be rotated. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.RotateAnnotations")
    End If
    annotationManager.Close()
Else
    MessageBox.Show("The AnnotationManager can't be properly initialized. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.RotateAnnotations")
End If
annotationManager.Dispose()
AnnotationManager annotationManager = new AnnotationManager();
if ((annotationManager.InitFromFile("image.jpg") == GdPictureStatus.OK) &&
    (annotationManager.PageCount > 0) && (annotationManager.SelectPage(1) == GdPictureStatus.OK))
{
    if (annotationManager.RotateAnnotations(90) == GdPictureStatus.OK)
    {
        if ((annotationManager.SaveAnnotationsToPage() == GdPictureStatus.OK) &&
            (annotationManager.BurnAnnotationsToPage(true) == GdPictureStatus.OK))
        {
            if (annotationManager.SaveDocumentToJPEG("image_rotated.jpg", 75) == GdPictureStatus.OK)
                MessageBox.Show("Finished successfully!", "AnnotationManager.RotateAnnotations");
            else
                MessageBox.Show("The file can't be saved. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.RotateAnnotations");
        }
        else
            MessageBox.Show("Annotations can't be saved or burned. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.RotateAnnotations");
    }
    else
        MessageBox.Show("Annotations can't be rotated. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.RotateAnnotations");
    annotationManager.Close();
}
else
    MessageBox.Show("The AnnotationManager can't be properly initialized. Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.RotateAnnotations");
annotationManager.Dispose();
See Also