func (r *Reader) Page(num int) Page {
	num-- // now 0-indexed
	page := r.Trailer().Key("Root").Key("Pages")
Search:
	for page.Key("Type").Name() == "Pages" {
		count := int(page.Key("Count").Int64())
		if count < num {
			return Page{}
		}
		kids := page.Key("Kids")
		for i := 0; i < kids.Len(); i++ {
			kid := kids.Index(i)
			if kid.Key("Type").Name() == "Pages" {
				c := int(kid.Key("Count").Int64())
				if num < c {
					page = kid
					continue Search
				}
				num -= c
				continue
			}
			if kid.Key("Type").Name() == "Page" {
				if num == 0 {
					return Page{kid}
				}
				num--
			}
		}
		break
	}
	return Page{}
}
func (r *Reader) Page(num int) Page {
	num-- 
	page := r.Trailer().Key("Root").Key("Pages")
Search:
	for page.Key("Type").Name() == "Pages" {
		count := int(page.Key("Count").Int64())
		if count < num {
			return Page{}
		}
		kids := page.Key("Kids")
		for i := 0; i < kids.Len(); i++ {
			kid := kids.Index(i)
			if kid.Key("Type").Name() == "Pages" {
				c := int(kid.Key("Count").Int64())
				if num < c {
					page = kid
					continue Search
				}
				num -= c
				continue
			}
			if kid.Key("Type").Name() == "Page" {
				if num == 0 {
					return Page{kid}
				}
				num--
			}
		}
		break
	}
	return Page{}
}
func ( r * Reader ) Page ( num int ) Page { num -- // now 0-indexed page := r . Trailer ( ) . Key ( " " ) . Key ( " " ) Search : for page . Key ( " " ) . Name ( ) == " " { count := int ( page . Key ( " " ) . Int64 ( ) ) if count < num { return Page { } } kids := page . Key ( " " ) for i := 0 ; i < kids . Len ( ) ; i ++ { kid := kids . Index ( i ) if kid . Key ( " " ) . Name ( ) == " " { c := int ( kid . Key ( " " ) . Int64 ( ) ) if num < c { page = kid continue Search } num -= c continue } if kid . Key ( " " ) . Name ( ) == " " { if num == 0 { return Page { kid } } num -- } } break } return Page { } }
// Page returns the page for the given page number.
// Page numbers are indexed starting at 1, not 0.
// If the page is not found, Page returns a Page with p.V.IsNull().
Page returns the page for the given page number . Page numbers are indexed starting at 1 not 0 . If the page is not found Page returns a Page with p . V . IsNull () .