GdPicture.NET.14
GdPicture14 Namespace / GdPicturePDF Class / RotatePages Method
The rotation angle, in degrees, determining the clockwise rotation. This parameter can be set to 90, -90, 180, -180, 270, -270 or any multiple of 90.
Example





In This Topic
RotatePages Method (GdPicturePDF)
In This Topic
Rotates clockwise all pages of the currently loaded PDF document. The rotation angle can be set to 90, 180 or 270 degrees.
Syntax
'Declaration
 
Public Function RotatePages( _
   ByVal Rotation As Integer _
) As GdPictureStatus
public GdPictureStatus RotatePages( 
   int Rotation
)
public function RotatePages( 
    Rotation: Integer
): GdPictureStatus; 
public function RotatePages( 
   Rotation : int
) : GdPictureStatus;
public: GdPictureStatus RotatePages( 
   int Rotation
) 
public:
GdPictureStatus RotatePages( 
   int Rotation
) 

Parameters

Rotation
The rotation angle, in degrees, determining the clockwise rotation. This parameter can be set to 90, -90, 180, -180, 270, -270 or any multiple of 90.

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 is only allowed for use with non-encrypted documents.

This method requires the Document Editor component to run.

Example
How to rotate all pages of the PDF document by 90 degrees.
Dim gdpicturePDF As New GdPicturePDF()
If gdpicturePDF.LoadFromFile("test.pdf", False) = GdPictureStatus.OK Then
    Dim status As GdPictureStatus = gdpicturePDF.RotatePages(90)
    If status = GdPictureStatus.OK Then
        Dim message As String = "The pages have been rotated successfully"
        If gdpicturePDF.SaveToFile("test_RotatePages.pdf") = GdPictureStatus.OK Then
            message = message + " and the file has been saved."
        Else
            message = message + ", but the file can't be saved."
        End If
        MessageBox.Show(message, "Example: RotatePages")
    Else
        MessageBox.Show("The RotatePages() method has failed with the status: " + status.ToString(), "Example: RotatePages")
    End If
Else
    MessageBox.Show("The file can't be loaded.", "Example: RotatePages")
End If
gdpicturePDF.Dispose()
GdPicturePDF gdpicturePDF = new GdPicturePDF();
if (gdpicturePDF.LoadFromFile("test.pdf", false) == GdPictureStatus.OK)
{
    GdPictureStatus status = gdpicturePDF.RotatePages(90);
    if (status == GdPictureStatus.OK)
    {
        string message = "The pages have been rotated successfully";
        if (gdpicturePDF.SaveToFile("test_RotatePages.pdf") == GdPictureStatus.OK)
            message = message + " and the file has been saved.";
        else
            message = message + ", but the file can't be saved.";
        MessageBox.Show(message, "Example: RotatePages");
    }
    else
        MessageBox.Show("The RotatePages() method has failed with the status: " + status.ToString(), "Example: RotatePages");
}
else
    MessageBox.Show("The file can't be loaded.", "Example: RotatePages");
gdpicturePDF.Dispose();
See Also