GetPaperSize Method (ActiveX)

Gets the width and height of the configured paper.

Supported platforms: Windows only

Signature

VBA:

object.GetPaperSize Width, Height
object

Type: Layout, PlotConfiguration

The objects this method applies to.

Width

Access: Output-only

Type: Double

The width of the paper.

Height

Access: Output-only

Type: Double

The height of the paper.

Return Value (RetVal)

No return value.

Remarks

The units for the width and height values are specified by the PaperUnits property.

To set the paper size, use the CanonicalMediaName property.

Examples

VBA:

Sub Example_GetPaperSize()
    ' This example gets the width and height of the default
    ' paper size for your system.
    
    Dim PaperWidth As Double
    Dim PaperHeight As Double
    
    ThisDrawing.ActiveLayout.GetPaperSize PaperWidth, PaperHeight
    
    MsgBox "The default paper size is " & vbCrLf & _
           "Width: " & PaperWidth & vbCrLf & _
           "Height: " & PaperHeight

End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_GetPaperSize()
    ;; This example gets the width and height of the default
    ;; paper size for your system.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    (vla-GetPaperSize (vla-get-ActiveLayout doc) 'PaperWidth 'PaperHeight)
    
    (alert (strcat "The default paper size is "
                   "\nWidth: " (rtos PaperWidth 2)
                   "\nHeight: " (rtos PaperHeight 2)))
)