How to set page orientation Aspose.pdf to landscape and portrait

We are attempting to the set page orientation using Aspose.pdf to landscape and portrait. We have tried several options and none seem to be working. When the first page of the PDF shows up, it appears to be landscape. When the page goes to page 2, it changes to portrait. We want to keep it landscape. How can we do this?

When we set up the page the first time, we use this code:
Dim page As Page = document.Pages(1)
Dim tempHeight As Decimal
Dim tempFontHeight As Decimal
tempFontHeight = CDec(1.055 * Fontsize * 1.02)
tempHeight = 1055 * PageHeight
page.SetPageSize(PageWidth, tempHeight) ’ 1055 is the height of the font Courier
Dim pageMargin As New MarginInfo
pageMargin.Left = Margin
pageMargin.Top = CDec(tempHeight) - CDec(tempHeight - Margin + tempFontHeight)
page.PageInfo.Margin = pageMargin

Later on, in the code we try and do it again this way but it still switches to portrait.

       Dim page As Page = document.Pages(1)
        Dim tempHeight As Decimal
        Dim tempFontHeight As Decimal
        tempFontHeight = CDec(1.055 * Fontsize * 1.02)
        tempHeight = 1055 * PageHeight
        page.SetPageSize(PageWidth, tempHeight) ' 1055 is the height of the font Courier
       Dim pageMargin As New MarginInfo
        pageMargin.Left = Margin
        pageMargin.Top = CDec(tempHeight) - CDec(tempHeight - Margin + tempFontHeight)
        page.PageInfo.Margin = pageMargin

        page = document.Pages(1)
        page = document.Pages.Add
        text.IsInNewPage = True
        priorLine = " "

@LeeWheeler

Would you kindly share your sample PDF document with us so that we can test the scenario in our environment and address it accordingly.