<!--
{
  "availability" : [
    "iOS: 3.2.0 -",
    "iPadOS: 3.2.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIGraphicsEndPDFContext()",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:@F@UIGraphicsEndPDFContext"
  },
  "title" : "UIGraphicsEndPDFContext()"
}
-->

# UIGraphicsEndPDFContext()

Closes a PDF graphics context and pops it from the current context stack.

```
func UIGraphicsEndPDFContext()
```

## Discussion

You must call this function after you finish drawing to a PDF graphics context. This function closes the current open page and removes the PDF context from the graphics context stack. It also releases the <doc://com.apple.documentation/documentation/CoreGraphics/CGContext> associated with the PDF context.  If the current graphics context is not a PDF context, this function does nothing.

---

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)