CGPDFDocumentRef issue

Discussion in 'Mac Programming' started by Fuzzball27, Jan 3, 2013.

  1. Fuzzball27
    Expand Collapse
    macrumors newbie

    Aug 8, 2011
    I'm missing something obvious here, but I can't remember what... :eek:

    Can someone explain to me why when I log "url" it comes out as expected, and when I create "document" I get error code -15?

    NSString *filePathString = [filePath stringValue];
        CFStringRef URLString = (CFStringRef)CFBridgingRetain(filePathString);
        CFStringRef URLStringEscaped = CFURLCreateStringByAddingPercentEscapes(NULL, URLString, NULL, NULL, kCFStringEncodingUTF8);
        CFURLRef url = CFURLCreateWithString(kCFAllocatorDefault, URLStringEscaped, NULL);
        NSLog(@"%@", url);
        CGPDFDocumentRef document = CGPDFDocumentCreateWithURL(url);
  2. Fuzzball27
    Expand Collapse
    thread starter macrumors newbie

    Aug 8, 2011
    Got it

    I figured it out:
    I should have been using "CFURLCreateWithFileSystemPath" not "CFURLCreateWithString"

Share This Page