I'm using python to write a bunch of scripts that dothings with CoreGraphics. I'm getting stuck when the API documentation uses pointers.
For instance:
for filename in sys.argv[1:]:
pdf = CGPDFDocumentCreateWithURL(CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault, filename, len(filename), False)) pages = CGPDFDocumentGetNumberOfPages(pdf) info = CGPDFDocumentGetInfo(pdf) print pages, info
pages = CGPDFDocumentGetNumberOfPages(pdf)
info = CGPDFDocumentGetInfo(pdf)
The pages variable comes out as an integer, with the number of pages. But info gives me:
PyObjCPointer created: at 0x7f8944f2c200 of type {CGPDFDictionary=}^{CGPDFDocument=}
Similarly, the Swift documentation for CGPDFDocumentGetVersion has this:
func CGPDFDocumentGetVersion(
_ document: CGPDFDocument?,
_ majorVersion: UnsafeMutablePointer<Int32>,
_ minorVersion: UnsafeMutablePointer<Int32>
)
and I have no idea how to do this in python.