BCL easyPDF SDK
easyPDF SDK Usermanual
PDF Creator Programming API  |  Download Free Trial  |  Contact Us to Purchase

GetPageRotation Method

Gets page rotation information from a PDF file.

Function GetPageRotation(Page As Long) As prcPageRotation

prcPageRotation GetPageRotation(int Page)

prcPageRotation GetPageRotation(int Page) throws PDFProcessorException

Parameters

Return Values

Page rotation value.

Remarks

The page number uses zero-based index, meaning that page number starts from 0.

Example Usage in VBScript

Set oProcessor = CreateObject("easyPDF.PDFProcessor.8")
Set oProcessorHandle = oProcessor.OpenFile("C:\test\input.pdf", "C:\test\input.pdf")

rot = oProcessorHandle.GetPageRotation(0)

oProcessorHandle.Close

 
Select Case rot
    Case PRC_ROT_0_DEG
        nRotation = 0
    Case PRC_ROT_90_DEG
        nRotation = 90
    Case PRC_ROT_180_DEG
        nRotation = 180
    Case PRC_ROT_270_DEG
        nRotation = 270
End Select
 
MsgBox "Page rotation: " + CStr(nRotation)

Example Usage in VB.NET

Dim oProcessor As PDFProcessor = New PDFProcessor
Dim oProcessorHandle As PDFProcessorHandle = oProcessor.OpenFile("C:\test\input.pdf", "C:\test\input.pdf")

Dim rot As prcPageRotation = oProcessorHandle.GetPageRotation(0)

oProcessorHandle.Close()

Dim nRotation As String
Select Case rot
    Case prcPageRotation.PRC_ROT_0_DEG
        nRotation = "0 degrees"
    Case prcPageRotation.PRC_ROT_90_DEG
        nRotation = "90 degrees"
    Case prcPageRotation.PRC_ROT_180_DEG
        nRotation = "180 degrees"
    Case prcPageRotation.PRC_ROT_270_DEG
        nRotation = "270 degrees"
    Case Else
        nRotation = "failed to detect rotation"
End Select

MessageBox.Show("Page rotation: " + nRotation)

Example Usage in C#

PDFProcessor oProcessor = new PDFProcessor();
PDFProcessorHandle oProcessorHandle = oProcessor.OpenFile(@"C:\test\input.pdf", @"C:\test\input.pdf", null);

prcPageRotation rot = oProcessorHandle.GetPageRotation(0);

oProcessorHandle.Close();

string nRotation;
switch(rot)
    {
    case prcPageRotation.PRC_ROT_0_DEG:
        nRotation = "0 degrees";
        break;
    case prcPageRotation.PRC_ROT_90_DEG:
        nRotation = "90 degrees";
        break;
    case prcPageRotation.PRC_ROT_180_DEG:
        nRotation = "180 degrees";
        break;
    case prcPageRotation.PRC_ROT_270_DEG:
        nRotation = "270 degrees";
        break;
    default:
        nRotation = "failed to detect rotation";
        break;
    }
        
MessageBox.Show("Page rotation: " + nRotation);