// xrefStart() queries the start of the xref-table in a PDF file. func xrefStart(f fancy.Reader) int { s := int(f.Size()) pdf := make([]byte, min(s, 1024)) f.ReadAt(pdf, int64(max(0, s-1024))) ps := xref.AllMatches(pdf, 0) if ps == nil { return -1 } return num(xref.MatchSlices(ps[len(ps)-1])[2]) }