mirror of
https://github.com/unidoc/unipdf.git
synced 2025-04-27 13:48:51 +08:00
Support [/DeviceRGB] when specified in an array. Closes #49.
This commit is contained in:
parent
a80d617bc7
commit
d241837196
@ -95,7 +95,16 @@ func newPdfColorspaceFromPdfObject(obj PdfObject) (PdfColorspace, error) {
|
||||
csObject = csArray
|
||||
}
|
||||
if name, is := (*csArray)[0].(*PdfObjectName); is {
|
||||
if *name == "CalGray" {
|
||||
if *name == "DeviceGray" && len(*csArray) == 1 {
|
||||
cs := NewPdfColorspaceDeviceGray()
|
||||
return cs, nil
|
||||
} else if *name == "DeviceRGB" && len(*csArray) == 1 {
|
||||
cs := NewPdfColorspaceDeviceRGB()
|
||||
return cs, nil
|
||||
} else if *name == "DeviceCMYK" && len(*csArray) == 1 {
|
||||
cs := NewPdfColorspaceDeviceCMYK()
|
||||
return cs, nil
|
||||
} else if *name == "CalGray" {
|
||||
cs, err := newPdfColorspaceCalGrayFromPdfObject(csObject)
|
||||
return cs, err
|
||||
} else if *name == "CalRGB" {
|
||||
@ -119,11 +128,13 @@ func newPdfColorspaceFromPdfObject(obj PdfObject) (PdfColorspace, error) {
|
||||
} else if *name == "DeviceN" {
|
||||
cs, err := newPdfColorspaceDeviceNFromPdfObject(csObject)
|
||||
return cs, err
|
||||
} else {
|
||||
common.Log.Debug("Array with invalid name: %s", *name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
common.Log.Error("Colorspace type error: %s", obj.String())
|
||||
common.Log.Debug("PDF File Error: Colorspace type error: %s", obj.String())
|
||||
return nil, errors.New("Type error")
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user