mirror of
https://github.com/unidoc/unipdf.git
synced 2025-05-04 22:17:22 +08:00
Minor fix to allow null for colorspace entry in Resource dicts
This commit is contained in:
parent
3f4e84a2e4
commit
78c6f01d03
@ -40,7 +40,7 @@ func NewPdfPageResourcesFromDict(dict *PdfObjectDictionary) (*PdfPageResources,
|
|||||||
if obj, isDefined := (*dict)["ExtGState"]; isDefined {
|
if obj, isDefined := (*dict)["ExtGState"]; isDefined {
|
||||||
r.ExtGState = obj
|
r.ExtGState = obj
|
||||||
}
|
}
|
||||||
if obj, isDefined := (*dict)["ColorSpace"]; isDefined {
|
if obj, isDefined := (*dict)["ColorSpace"]; isDefined && !isNullObject(obj) {
|
||||||
colorspaces, err := newPdfPageResourcesColorspacesFromPdfObject(obj)
|
colorspaces, err := newPdfPageResourcesColorspacesFromPdfObject(obj)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -28,6 +28,14 @@ func getNumberAsFloat(obj PdfObject) (float64, error) {
|
|||||||
return 0, errors.New("Not a number")
|
return 0, errors.New("Not a number")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isNullObject(obj PdfObject) bool {
|
||||||
|
if _, isNull := obj.(*PdfObjectNull); isNull {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Convert a list of pdf objects representing floats or integers to a slice of float64 values.
|
// Convert a list of pdf objects representing floats or integers to a slice of float64 values.
|
||||||
func getNumbersAsFloat(objects []PdfObject) ([]float64, error) {
|
func getNumbersAsFloat(objects []PdfObject) ([]float64, error) {
|
||||||
floats := []float64{}
|
floats := []float64{}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user