Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7898571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:28:09+00:00 2026-06-03T08:28:09+00:00

For my Cocoa app I need to know whether a given CGContextRef is a

  • 0

For my Cocoa app I need to know whether a given CGContextRef is a PDF context (as opposed to a bitmap or screen context) in order to take a different rendering path in my CALayer’s drawInContext implementation. With the iOS SDK, I can do this with:

BOOL isPDF = !CGRectIsEmpty(UIGraphicsGetPDFContextBounds());

But UIGraphics* functions aren’t available in the OS X SDK. I was hoping to be able to use:

BOOL isPDf = CFGetTypeID(currentContext) != CGContextGetTypeID();

But it doesn’t seem to hold true, and there is no CGPDFContextGetTypeID() function that returns a type ID specific to PDFs.

Is there any way to identify the type of a given CGContextRef without doing anything nasty like setting static variables?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T08:28:10+00:00Added an answer on June 3, 2026 at 8:28 am

    There is no public API for getting the type of a CGContextRef, so you will have to keep this information outside of the context ref itself.

    There is an undocumented CGContextGetType() function that returns the type of the context, see the CGContextType enum for a list of possible values. But you should really not use this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a Cocoa/Objective-C app in XCode4, and I need to know when
I am developing an app in Cocoa. I need to show a progress at
I'm writing a Cocoa app that will need access to multiple file transfer protocols,
I'm writing a Cocoa app and basically I have a window and I need
Can the launchApplcation call be usedv in a non-Cocoa app? I need the equivalent
I need to parse EML files within a Cocoa app. Are there some Objective-C
I'm working on a Cocoa Mac app where I need to display a window/view
In my Cocoa app, I need to handle swipe gestures in a non-key window.
How do you capture an NSImage of the screen in Cocoa? I need to
The situation I'm trying to solve: in my Cocoa app, I need to encrypt

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.