Export trailer dict from reader

This commit is contained in:
Gunnsteinn Hall 2017-03-02 12:50:45 +00:00
parent 8b2146ea10
commit e8c0a4be98

View File

@ -530,7 +530,7 @@ func (this *PdfReader) buildPageList(node *PdfIndirectObject, parent *PdfIndirec
return nil return nil
} }
if *objType != "Pages" { if *objType != "Pages" {
common.Log.Trace("ERROR: Table of content containing non Page/Pages object! (%s)", objType) common.Log.Debug("ERROR: Table of content containing non Page/Pages object! (%s)", objType)
return errors.New("Table of content containing non Page/Pages object!") return errors.New("Table of content containing non Page/Pages object!")
} }
@ -747,8 +747,17 @@ func (this *PdfReader) Inspect() (map[string]int, error) {
return this.parser.Inspect() return this.parser.Inspect()
} }
// Get specific object number // Get specific object number.
func (this *PdfReader) GetIndirectObjectByNumber(number int) (PdfObject, error) { func (this *PdfReader) GetIndirectObjectByNumber(number int) (PdfObject, error) {
obj, err := this.parser.LookupByNumber(number) obj, err := this.parser.LookupByNumber(number)
return obj, err return obj, err
} }
func (this *PdfReader) GetTrailer() (*PdfObjectDictionary, error) {
trailerDict := this.parser.GetTrailer()
if trailerDict == nil {
return nil, errors.New("Trailer missing")
}
return trailerDict, nil
}