Skip to content

Commit

Permalink
Attempt to identify Pages nodes without Type (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrg authored and gunnsth committed Jun 11, 2019
1 parent 4290e33 commit 441e9a3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion model/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down

0 comments on commit 441e9a3

Please sign in to comment.