CoreGraphics gives the possibility to render PDF documents, this is great. But it seems like it could support other types too like Word documents, HTML, RTF and others.
A quick look in the doc2pdf.py example on the Mac OS X Developer DVD makes me think so :
pageRect = CGRectMake(0, 0, 612, 792) c = CGPDFContextCreateWithFilename(output_file, pageRect) c.beginPage(pageRect) if fnmatch(ext,".txt") or fnmatch(ext,".?") or fnmatch(ext,".??"): tr = c.drawPlainTextInRect(text, pageRect, font_size) elif fnmatch(ext,".rtf"): tr = c.drawRTFTextInRect(text, pageRect, font_size) elif fnmatch(ext,".htm*") or fnmatch(ext,".php"): tr = c.drawHTMLTextInRect(text, pageRect, font_size) elif fnmatch(ext,".doc"): tr = c.drawDocFormatTextInRect(text, pageRect, font_size) elif fnmatch(ext,"*ml"): tr = c.drawWordMLFormatTextInRect(text, pageRect, font_size) else: return "Error: unknown type '%s' for '%s'"%(ext, input_file)
Unfortunately, I do not understand how works the CoreGraphics' Python bindings (and it seems that the binding itself is binary and proprietary). I cannot find the C/Obj-C equivalent for these methods in Apple developers documentation. And there is not much webpages found by Google talking about these functionnality.
Any ideas ?