<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: 10.0.0 - 10.5.0",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreGraphics",
  "identifier" : "/documentation/CoreGraphics/CGPDFDocumentGetMediaBox",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Graphics"
    ],
    "preciseIdentifier" : "c:@F@CGPDFDocumentGetMediaBox"
  },
  "title" : "CGPDFDocumentGetMediaBox"
}
-->

# CGPDFDocumentGetMediaBox

Returns the media box of a page in a PDF document.

```
extern CGRect CGPDFDocumentGetMediaBox(CGPDFDocumentRef document, int page);
```

## Parameters

`document`

The PDF document to examine.

`page`

An integer that specifies the number of the page to examine.

## Return Value

A rectangle that represents the media box for the specified page, expressed in default PDF user space units (points).

## Discussion

The replacement function for this one is [`getBoxRect(_:)`](/documentation/CoreGraphics/CGPDFPage/getBoxRect(_:)), which gets the rectangle associated with a type of box (art, media, crop, bleed trim) that represents a content region or page dimensions of a PDF page. For more information see [`CGPDFPage`](/documentation/CoreGraphics/CGPDFPage).

The media box defines the location and size of the physical medium on which the page is intended to be displayed or printed. For example, if the page size is 8.5 by 11 inches, this function returns the coordinate pairs `(0,0)` and (`612,792)`.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)