Skip to content

Commit

Permalink
Fix in handling of indexed colorspace parsing inline images when usin…
Browse files Browse the repository at this point in the history
…g base=DeviceRGB rather than shortcut. Closes #114.
  • Loading branch information
Gunnsteinn Hall authored and Gunnsteinn Hall committed Aug 11, 2017
1 parent 50041f0 commit e970ac4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pdf/contentstream/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func newIndexedColorspaceFromPdfObject(obj core.PdfObject) (model.PdfColorspace,
common.Log.Debug("Error: Invalid cs array first element not a name (array: %#v)", *arr)
return nil, errors.New("Type check error")
}
if *name != "I" {
if *name != "I" && *name != "Indexed" {
common.Log.Debug("Error: Invalid cs array first element != I (got: %v)", *name)
return nil, errors.New("Range check error")
}
Expand All @@ -74,17 +74,17 @@ func newIndexedColorspaceFromPdfObject(obj core.PdfObject) (model.PdfColorspace,
common.Log.Debug("Error: Invalid cs array 2nd element not a name (array: %#v)", *arr)
return nil, errors.New("Type check error")
}
if *name != "G" && *name != "RGB" && *name != "CMYK" {
if *name != "G" && *name != "RGB" && *name != "CMYK" && *name != "DeviceGray" && *name != "DeviceRGB" && *name != "DeviceCMYK" {
common.Log.Debug("Error: Invalid cs array 2nd element != G/RGB/CMYK (got: %v)", *name)
return nil, errors.New("Range check error")
}
basename := ""
switch *name {
case "G":
case "G", "DeviceGray":
basename = "DeviceGray"
case "RGB":
case "RGB", "DeviceRGB":
basename = "DeviceRGB"
case "CMYK":
case "CMYK", "DeviceCMYK":
basename = "DeviceCMYK"
}

Expand Down

0 comments on commit e970ac4

Please sign in to comment.