How do I rotate a PDF page?

Q: The code listed below is how we rotate PDF files with PDFTron. Can
you please advise whether we are rotating the file incorrectly or this
a defect in the file.

VB.NET sample code:

Public Shared Sub RotatePdf(ByVal sourcePdfFilePath As String, ByVal
destinationFilePath As String, ByVal rotation As Rotation)

        Dim objDoc As PDFDoc = Nothing
        Dim oExportedFileNames As Generic.List(Of String) = Nothing
        Dim strExportFileName As String = String.Empty
        Dim itr As PageIterator = Nothing
        Dim intCurrentPageNumber As Integer = 1
        Dim eRotate As PDFTRON.PDF.Page.Rotate =

            \'verify file
            If File.Exists(sourcePdfFilePath) = False Then Throw New
FileNotFoundException(\"File: \" & sourcePdfFilePath)

            \'verify destination directory
            If Directory.Exists(Path.GetDirectoryName
(destinationFilePath)) = False Then Throw New
DirectoryNotFoundException(\"Destination directory does not exist: \"
& Path.GetDirectoryName(destinationFilePath))


            \'open source
            objDoc = New PDFDoc(sourcePdfFilePath)

            itr = objDoc.GetPageIterator()

            Select Case rotation
                Case PdfEngine.Rotation.rt180
                    eRotate = PDFTRON.PDF.Page.Rotate.e_180
                Case PdfEngine.Rotation.rt90CCW
                    eRotate = PDFTRON.PDF.Page.Rotate.e_270
                Case PdfEngine.Rotation.rt90CW
                    eRotate = PDFTRON.PDF.Page.Rotate.e_90
                Case Else
                    eRotate = PDFTRON.PDF.Page.Rotate.e_0
            End Select

            While itr.HasNext()

                intCurrentPageNumber = itr.GetPageNumber()



            End While

            \'yes save by linearization

            objDoc = Nothing
        End Try
    End Sub
A: The problem is that you are applying specific rotation to a given
page, but the page is already rotated (i.e. page.GetRotate() returns
270). To fix the problem you need to add your additional rotation to
the existing rotation value.