'Gives the MediaBox of the page
'A rectangle, expressed in default user space units, defining the boundaries of the physical medium on which the page is intended to be displayed or printed.
'Returns a PDFrectangle where:
' .x and .y is lower left corner of the page
' .height and .width is the height and width of the MadiaBox
Public Sub getMediaBox(p As Int) As PDFrectangle
Dim pg As JavaObject = thisDoc.RunMethodJO("getPage",Array(p))
Dim r As PDFrectangle
r.Initialize
Dim mb As JavaObject = pg.RunMethodJO("getMediaBox",Null)
If getRotationAngle(p) Mod 180 = 0 Then
r.height = mb.RunMethod("getHeight",Null)
r.width = mb.RunMethod("getWidth",Null)
r.x = mb.RunMethod("getLowerLeftX",Null)
r.y = mb.RunMethod("getLowerLeftY",Null)
Else
r.height = mb.RunMethod("getWidth",Null)
r.width = mb.RunMethod("getHeight",Null)
r.y = mb.RunMethod("getLowerLeftX",Null)
r.x = mb.RunMethod("getLowerLeftY",Null)
End If
Return r
End Sub