GdPicture.NET.14
GdPicture14 Namespace / GdPicturePDF Class / RotatePage 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





RotatePage Method (GdPicturePDF)
Rotates clockwise the currently selected page of the loaded PDF document. The rotation angle can be set to 90, 180 or 270 degrees.
Syntax
'Declaration
 
Public Function RotatePage( _
   ByVal Rotation As Integer _
) As GdPictureStatus
 

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 your document step by step by multiple of 90 degrees, that means each page is rotated by next (means page number) multiple of 90. You can subsequently determine the actual page rotation.
Dim caption As String = "Example: RotatePage"
Dim gdpicturePDF As New GdPicturePDF()
If gdpicturePDF.LoadFromFile("test.pdf", False) = GdPictureStatus.OK Then
    Dim count As Integer = gdpicturePDF.GetPageCount()
    Dim status As GdPictureStatus = gdpicturePDF.GetStat()
    If status = GdPictureStatus.OK Then
        For i As Integer = 1 To count
            status = gdpicturePDF.SelectPage(i)
            If status = GdPictureStatus.OK Then
                status = gdpicturePDF.RotatePage(i * 90)
                If status = GdPictureStatus.OK Then
                    Dim rotation As Integer = gdpicturePDF.GetPageRotation()
                    status = gdpicturePDF.GetStat()
                    If status = GdPictureStatus.OK Then
                        MessageBox.Show("The rotation angle of the page nr." + i.ToString() + " is " + rotation.ToString() + " degrees.", caption)
                    Else
                        MessageBox.Show("The GetPageRotation() method has failed with the status: " + status.ToString(), caption)
                    End If
                    If i = count Then
                        If gdpicturePDF.SaveToFile("test_RotatePage.pdf") = GdPictureStatus.OK Then
                            MessageBox.Show("The pages have been rotated successfully and the file has been saved.", caption)
                        Else
                            MessageBox.Show("The pages have been rotated successfully but the file can't be saved.", caption)
                        End If
                    End If
                Else
                    MessageBox.Show("The RotatePage() method has failed with the status: " + status.ToString(), caption)
                    Exit For
                End If
            Else
                MessageBox.Show("The SelectPage() method has failed with the status: " + status.ToString(), caption)
                Exit For
            End If
        Next
    Else
        MessageBox.Show("The GetPageCount() method has failed with the status: " + status.ToString(), caption)
    End If
Else
    MessageBox.Show("The file can't be loaded.", caption)
End If
gdpicturePDF.Dispose()
See Also