Attempt to identify Pages nodes without Type (#85)

This commit is contained in:
Adrian-George Bostan 2019-06-12 01:02:36 +03:00 committed by Gunnsteinn Hall
parent 4290e33c36
commit 441e9a3177

View File

@ -502,7 +502,13 @@ func (r *PdfReader) buildPageList(node *core.PdfIndirectObject, parent *core.Pdf
objType, ok := (*nodeDict).Get("Type").(*core.PdfObjectName)
if !ok {
return errors.New("node missing Type (Required)")
if nodeDict.Get("Kids") == nil {
return errors.New("node missing Type (Required)")
}
common.Log.Debug("ERROR: node missing Type, but has Kids. Assuming Pages node.")
objType = core.MakeName("Pages")
nodeDict.Set("Type", objType)
}
common.Log.Trace("buildPageList node type: %s (%+v)", *objType, node)
if *objType == "Page" {