2009-01-10 09:14:46 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
import sys
|
2009-05-17 14:02:57 +00:00
|
|
|
from pdfminer.psparser import PSLiteralTable
|
2009-01-10 09:14:46 +00:00
|
|
|
|
|
|
|
|
2009-05-15 14:25:32 +00:00
|
|
|
## PDFColorSpace
|
2009-01-10 09:14:46 +00:00
|
|
|
##
|
|
|
|
LITERAL_DEVICE_GRAY = PSLiteralTable.intern('DeviceGray')
|
|
|
|
LITERAL_DEVICE_RGB = PSLiteralTable.intern('DeviceRGB')
|
|
|
|
LITERAL_DEVICE_CMYK = PSLiteralTable.intern('DeviceCMYK')
|
|
|
|
|
2009-05-15 14:25:32 +00:00
|
|
|
class PDFColorSpace(object):
|
2009-01-10 09:14:46 +00:00
|
|
|
|
|
|
|
def __init__(self, name, ncomponents):
|
|
|
|
self.name = name
|
|
|
|
self.ncomponents = ncomponents
|
|
|
|
return
|
|
|
|
|
|
|
|
def __repr__(self):
|
2009-05-15 14:25:32 +00:00
|
|
|
return '<PDFColorSpace: %s, ncomponents=%d>' % (self.name, self.ncomponents)
|
2009-01-10 09:14:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
PREDEFINED_COLORSPACE = dict(
|
2009-05-15 14:25:32 +00:00
|
|
|
(name, PDFColorSpace(name,n)) for (name,n) in {
|
2009-01-10 09:14:46 +00:00
|
|
|
'CalRGB': 3,
|
|
|
|
'CalGray': 1,
|
|
|
|
'Lab': 3,
|
|
|
|
'DeviceRGB': 3,
|
|
|
|
'DeviceCMYK': 4,
|
|
|
|
'DeviceGray': 1,
|
|
|
|
'Separation': 1,
|
|
|
|
'Indexed': 1,
|
|
|
|
'Pattern': 1,
|
|
|
|
}.iteritems())
|