A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/pythonmac-sig/2003-October/009163.html below:

[Pythonmac-SIG] CoreGraphics and Python and Panther

[Pythonmac-SIG] CoreGraphics and Python and PantherGus Mueller gus at mu.org
Fri Oct 24 23:50:47 EDT 2003
I just wanted to say that wow, the CoreGraphics module in 10.3's python
is awesome.  Very neat, and I'm sure we're going to see some really cool
stuff come out of it.

Making pdf's has never been so easy.

#!/usr/bin/python
import os
from CoreGraphics import *
from urllib2 import *

html = urlopen("http://www.python.org/").read()

pageRect = CGRectMake(0, 0, 612, 792)
ctx = CGPDFContextCreateWithFilename("python.pdf", pageRect)
ctx.beginPage(pageRect)
ctx.drawHTMLTextInRect(CGDataProviderCreateWithString(html), pageRect)
ctx.endPage()
ctx.finish()

os.popen("/usr/bin/open -a Preview python.pdf")


If whomever is responsible for this at Apple is listening- thanks!

-gus

--   
August Mueller
http://flyingmeat.com/
VoodooPad - 1st Place U.S., O'Reilly Mac OS X Innovators Contest round 2
"Christmas means carnage!"  -- Ferdinand, the duck

More information about the Pythonmac-SIG mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4